diff options
author | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2014-06-06 10:42:50 +0000 |
---|---|---|
committer | Thomas Preud'homme <thopre01@gcc.gnu.org> | 2014-06-06 10:42:50 +0000 |
commit | 4ed689957552caedec3c15251a126b2074bd1df2 (patch) | |
tree | 1536e2d294440c98ff88930361b4d910f439cfec /gcc | |
parent | 506ac72b863d18d2ba616b6d186d668993bc9f70 (diff) | |
download | gcc-4ed689957552caedec3c15251a126b2074bd1df2.zip gcc-4ed689957552caedec3c15251a126b2074bd1df2.tar.gz gcc-4ed689957552caedec3c15251a126b2074bd1df2.tar.bz2 |
bswap-2.c: Add alignment constraints to bitfield and test wrong results instead of correct...
2014-06-06 Thomas Preud'homme <thomas.preudhomme@arm.com>
* gcc.c-torture/execute/bswap-2.c: Add alignment constraints to
bitfield and test wrong results instead of correct results to make the
test more portable.
From-SVN: r211313
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/bswap-2.c | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7c688c..7556316 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-06-06 Thomas Preud'homme <thomas.preudhomme@arm.com> + + * gcc.c-torture/execute/bswap-2.c: Add alignment constraints to + bitfield and test wrong results instead of correct results to make the + test more portable. + 2014-06-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60432 diff --git a/gcc/testsuite/gcc.c-torture/execute/bswap-2.c b/gcc/testsuite/gcc.c-torture/execute/bswap-2.c index 38f18fd..a47e01a 100644 --- a/gcc/testsuite/gcc.c-torture/execute/bswap-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/bswap-2.c @@ -6,8 +6,11 @@ typedef __UINT32_TYPE__ unsigned; struct bitfield { unsigned char f0:7; + unsigned char :1; unsigned char f1:7; + unsigned char :1; unsigned char f2:7; + unsigned char :1; unsigned char f3:7; }; @@ -74,11 +77,17 @@ main () return 0; bfin.inval = (struct ok) { 0x83, 0x85, 0x87, 0x89 }; out = partial_read_le32 (bfin); - if (out != 0x09070503 && out != 0x88868482 && out != 0x78306141) + /* Test what bswap would do if its check are not strict enough instead of + what is the expected result as there is too many possible results with + bitfields. */ + if (out == 0x89878583) __builtin_abort (); bfin.inval = (struct ok) { 0x83, 0x85, 0x87, 0x89 }; out = partial_read_be32 (bfin); - if (out != 0x03050709 && out != 0x82848688 && out != 0x41613078) + /* Test what bswap would do if its check are not strict enough instead of + what is the expected result as there is too many possible results with + bitfields. */ + if (out == 0x83858789) __builtin_abort (); out = fake_read_le32 (cin, &cin[2]); if (out != 0x89018583) |