diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2003-12-05 11:58:20 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@gcc.gnu.org> | 2003-12-05 11:58:20 +0000 |
commit | 64ed86c71833cb21c29cee783cde01c5e1a3d2f4 (patch) | |
tree | bd677fadb6392bac2c5a8c300f9a8937bf054531 | |
parent | 73fb6466a4017f596d131bc2472a265766f761cc (diff) | |
download | gcc-64ed86c71833cb21c29cee783cde01c5e1a3d2f4.zip gcc-64ed86c71833cb21c29cee783cde01c5e1a3d2f4.tar.gz gcc-64ed86c71833cb21c29cee783cde01c5e1a3d2f4.tar.bz2 |
re PR target/13256 (strict_low_part mistreated in delay slots)
PR target/13256
* gcc.c-torture/execute/20031201-1.c: New test.
From-SVN: r74329
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20031201-1.c | 76 |
2 files changed, 81 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 100d058..5a00a7a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-12-05 Hans-Peter Nilsson <hp@axis.com> + + PR target/13256 + * gcc.c-torture/execute/20031201-1.c: New test. + 2003-12-05 Arnaud Charlet <charlet@act-europe.fr> * ada/acats/run_acats: Add checks against missing gnatlib/gnattools. diff --git a/gcc/testsuite/gcc.c-torture/execute/20031201-1.c b/gcc/testsuite/gcc.c-torture/execute/20031201-1.c new file mode 100644 index 0000000..7c8e0ea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031201-1.c @@ -0,0 +1,76 @@ +/* Copyright (C) 2003 Free Software Foundation. + PR target/13256 + STRICT_LOW_PART was handled incorrectly in delay slots. + Origin: Hans-Peter Nilsson. */ + +typedef struct { unsigned int e0 : 16; unsigned int e1 : 16; } s1; +typedef struct { unsigned int e0 : 16; unsigned int e1 : 16; } s2; +typedef struct { s1 i12; s2 i16; } io; +static int test_length = 2; +static io *i; +static int m = 1; +static int d = 1; +static unsigned long test_t0; +static unsigned long test_t1; +void test(void) __attribute__ ((__noinline__)); +extern int f1 (void *port) __attribute__ ((__noinline__)); +extern void f0 (void) __attribute__ ((__noinline__)); +int +f1 (void *port) +{ + int fail_count = 0; + unsigned long tlen; + s1 x0 = {0}; + s2 x1 = {0}; + + i = port; + x0.e0 = x1.e0 = 32; + i->i12 = x0; + i->i16 = x1; + do f0(); while (test_t1); + x0.e0 = x1.e0 = 8; + i->i12 = x0; + i->i16 = x1; + test (); + if (m) + { + unsigned long e = 1000000000 / 460800 * test_length; + tlen = test_t1 - test_t0; + if (((tlen-e) & 0x7FFFFFFF) > 1000) + f0(); + } + if (d) + { + unsigned long e = 1000000000 / 460800 * test_length; + tlen = test_t1 - test_t0; + if (((tlen - e) & 0x7FFFFFFF) > 1000) + f0(); + } + return fail_count != 0 ? 1 : 0; +} + +int +main () +{ + io io0; + f1 (&io0); + abort (); +} + +void +test (void) +{ + io *iop = i; + if (iop->i12.e0 != 8 || iop->i16.e0 != 8) + abort (); + exit (0); +} + +void +f0 (void) +{ + static int washere = 0; + io *iop = i; + if (washere++ || iop->i12.e0 != 32 || iop->i16.e0 != 32) + abort (); +} |