diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-22 10:27:42 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-22 10:27:42 +0000 |
commit | 15afdcb02e5ed00028343f5b6b9733566f289ef6 (patch) | |
tree | 1f9cb8c1b2eb4a04d37ff703545db63355f2fad2 /gcc/testsuite | |
parent | 3d4c18fefda9eb62e7e13c11a858152eb2199a63 (diff) | |
download | gcc-15afdcb02e5ed00028343f5b6b9733566f289ef6.tar.gz |
2011-08-22 Richard Guenther <rguenther@suse.de>
PR testsuite/50145
* gcc.dg/torture/pr50067-1.c: Run on little-endian systems only.
* gcc.dg/torture/pr50067-2.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177952 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr50067-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr50067-2.c | 13 |
3 files changed, 24 insertions, 8 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b0b54dece75..b81501bbebb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-08-22 Richard Guenther <rguenther@suse.de> + + PR testsuite/50145 + * gcc.dg/torture/pr50067-1.c: Run on little-endian systems only. + * gcc.dg/torture/pr50067-2.c: Likewise. + 2011-08-21 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/47659 diff --git a/gcc/testsuite/gcc.dg/torture/pr50067-1.c b/gcc/testsuite/gcc.dg/torture/pr50067-1.c index 8f72d26d713..8201ebfdc91 100644 --- a/gcc/testsuite/gcc.dg/torture/pr50067-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr50067-1.c @@ -9,10 +9,15 @@ short a[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 short b[32] = { 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, }; int main() { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ int i; - for (i = 0; i < 32; ++i) - (*((unsigned short(*)[32])&a[0]))[i] = (*((char(*)[32])&a[0]))[i+8]; - if (memcmp (&a, &b, sizeof (a)) != 0) - abort (); + if (sizeof (short) == 2) + { + for (i = 0; i < 32; ++i) + (*((unsigned short(*)[32])&a[0]))[i] = (*((char(*)[32])&a[0]))[i+8]; + if (memcmp (&a, &b, sizeof (a)) != 0) + abort (); + } +#endif return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr50067-2.c b/gcc/testsuite/gcc.dg/torture/pr50067-2.c index ee9fbb904c1..f9728a76678 100644 --- a/gcc/testsuite/gcc.dg/torture/pr50067-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr50067-2.c @@ -9,12 +9,17 @@ short a[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 short b[32] = { 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, }; int main() { +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ int i; - for (i = 0; i < 32; ++i) + if (sizeof (short) == 2) { - a[i] = (*((char(*)[32])&a[0]))[i+8]; + for (i = 0; i < 32; ++i) + { + a[i] = (*((char(*)[32])&a[0]))[i+8]; + } + if (memcmp (&a, &b, sizeof (a)) != 0) + abort (); } - if (memcmp (&a, &b, sizeof (a)) != 0) - abort (); +#endif return 0; } |