diff options
author | Giuliano Procida <gprocida@google.com> | 2023-11-13 18:09:02 +0000 |
---|---|---|
committer | Giuliano Procida <gprocida@google.com> | 2023-11-15 09:17:19 +0000 |
commit | 1905a67d5fe0bfd048729e92141ae2a4666debfb (patch) | |
tree | fe9e1d4f71a0cb0800e995f6d582d5288090401c | |
parent | a481f61bd83fd594c4274bc6a106e7f6a5aa04a9 (diff) | |
download | stg-1905a67d5fe0bfd048729e92141ae2a4666debfb.tar.gz |
test cases: adjust function/variadic_parameter tests to work with gcc -O2
These cases are tweaked to avoid triggering a GCC bug where optimisation
destroys some debug information.
It suffices to ensure that all the functions compile to different code.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112372
Add note to document that function types of the form `T(...)` are
incorrectly represented by G++ due to a separate issue.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111788
PiperOrigin-RevId: 582002845
Change-Id: I50c397649ebf7ba733d13dee74f1dbbeb2b569fb
-rw-r--r-- | test_cases/diff_tests/function/variadic_parameter.0.cc | 9 | ||||
-rw-r--r-- | test_cases/diff_tests/function/variadic_parameter.1.cc | 9 | ||||
-rw-r--r-- | test_cases/info_tests/function/variadic_parameter.cc | 9 |
3 files changed, 15 insertions, 12 deletions
diff --git a/test_cases/diff_tests/function/variadic_parameter.0.cc b/test_cases/diff_tests/function/variadic_parameter.0.cc index 627baa9..c026ed7 100644 --- a/test_cases/diff_tests/function/variadic_parameter.0.cc +++ b/test_cases/diff_tests/function/variadic_parameter.0.cc @@ -1,4 +1,5 @@ -int foo1(int x, int y) { return x + y; } -int foo2(int x, int y) { return x + y; } -int foo3(int x, int y, ...) { return x + y; } -int foo4(int x, ...) { return x; } +int foo1(int x, int y) { return x + y + 1; } +int foo2(int x, int y) { return x + y + 2; } +int foo3(int x, int y, ...) { return x + y + 3; } +// GCC omits the ...: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111788 +int foo4(int x, ...) { return x + 4; } diff --git a/test_cases/diff_tests/function/variadic_parameter.1.cc b/test_cases/diff_tests/function/variadic_parameter.1.cc index 3dcea95..e8808fe 100644 --- a/test_cases/diff_tests/function/variadic_parameter.1.cc +++ b/test_cases/diff_tests/function/variadic_parameter.1.cc @@ -1,4 +1,5 @@ -int foo1(int x, int y, ...) { return x + y; } -int foo2(int x, ...) { return x; } -int foo3(int x, int y) { return x + y; } -int foo4(...) { return 0; } +int foo1(int x, int y, ...) { return x + y + 1; } +int foo2(int x, ...) { return x + 2; } +int foo3(int x, int y) { return x + y + 3; } +// GCC omits the ...: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111788 +int foo4(...) { return 4; } diff --git a/test_cases/info_tests/function/variadic_parameter.cc b/test_cases/info_tests/function/variadic_parameter.cc index 3dcea95..e8808fe 100644 --- a/test_cases/info_tests/function/variadic_parameter.cc +++ b/test_cases/info_tests/function/variadic_parameter.cc @@ -1,4 +1,5 @@ -int foo1(int x, int y, ...) { return x + y; } -int foo2(int x, ...) { return x; } -int foo3(int x, int y) { return x + y; } -int foo4(...) { return 0; } +int foo1(int x, int y, ...) { return x + y + 1; } +int foo2(int x, ...) { return x + 2; } +int foo3(int x, int y) { return x + y + 3; } +// GCC omits the ...: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111788 +int foo4(...) { return 4; } |