testsuite: Add compat.exp testcase for most common zero width bitfld ABI passing...
authorJakub Jelinek <jakub@redhat.com>
Thu, 24 Mar 2022 11:25:15 +0000 (12:25 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 24 Mar 2022 11:25:15 +0000 (12:25 +0100)
commit568377743e22c1377d0aaa1ac9113da3ff1b6bd4
tree5d52878ec1eeb045c6528756457b6185847ae74b
parent8698ff67cdff4364c8adad2921ed532359a155ec
testsuite: Add compat.exp testcase for most common zero width bitfld ABI passing [PR102024]

On Tue, Mar 22, 2022 at 05:51:58PM +0100, Jakub Jelinek via Gcc wrote:
> I guess it would be nice to include the testcases we are talking about,
> like { float x; int : 0; float y; } and { float x; int : 0; } and
> { int : 0; float x; } into compat.exp testsuite so that we see ABI
> differences in compat testing.

Here is a patch that does that.  It uses the struct-layout-1* framework,
but isn't generated because we don't want in this case pseudo-random
structure layouts, but particular ones we know cause or could cause problems
on some targets.  If other problematic cases are discovered, we can add
further ones.

Tested on x86_64-linux with:
make check-gcc check-g++ RUNTESTFLAGS='ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ compat.exp=pr102*'
and with
make check-gcc check-g++ RUNTESTFLAGS='compat.exp=pr102*'
The former as expected has:
FAIL: gcc.dg/compat/pr102024 c_compat_x_tst.o-c_compat_y_alt.o execute
FAIL: gcc.dg/compat/pr102024 c_compat_x_alt.o-c_compat_y_tst.o execute
fails because on x86_64 we've changed the C ABI but kept the C++ ABI here.
E.g. on rs6000 it should be the g++.dg such tests to fail (all assuming
the alt gcc/g++ is GCC 4.5 through 11).

2022-03-24  Jakub Jelinek  <jakub@redhat.com>

PR target/102024
* gcc.dg/compat/pr102024_main.c: New test.
* gcc.dg/compat/pr102024_test.h: New test.
* gcc.dg/compat/pr102024_x.c: New test.
* gcc.dg/compat/pr102024_y.c: New test.
* g++.dg/compat/pr102024_main.C: New test.
* g++.dg/compat/pr102024_test.h: New test.
* g++.dg/compat/pr102024_x.C: New test.
* g++.dg/compat/pr102024_y.C: New test.
gcc/testsuite/g++.dg/compat/pr102024_main.C [new file with mode: 0644]
gcc/testsuite/g++.dg/compat/pr102024_test.h [new file with mode: 0644]
gcc/testsuite/g++.dg/compat/pr102024_x.C [new file with mode: 0644]
gcc/testsuite/g++.dg/compat/pr102024_y.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/pr102024_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/pr102024_test.h [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/pr102024_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/pr102024_y.c [new file with mode: 0644]