diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-06 22:51:05 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-06 22:51:05 +0000 |
commit | e1647522f93999450cc558341bb2066ca26e070f (patch) | |
tree | ec9704394836b7bb5123d7d8c1d9647eace77c5d /gcc/testsuite/gcc.c-torture | |
parent | 035ef3e66f39f67a3fab95825e0fbc750bc8160d (diff) | |
download | gcc-e1647522f93999450cc558341bb2066ca26e070f.tar.gz |
2009-11-06 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 153975
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@153981 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr41917.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr41919.c | 39 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr41935.c | 25 |
3 files changed, 85 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41917.c b/gcc/testsuite/gcc.c-torture/execute/pr41917.c new file mode 100644 index 00000000000..4a9ada921c4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41917.c @@ -0,0 +1,21 @@ +/* PR rtl-optimization/41917 */ + +extern void abort (void); +unsigned int a = 1; + +int +main (void) +{ + unsigned int b, c, d; + + if (sizeof (int) != 4 || (int) 0xc7d24b5e > 0) + return 0; + + c = 0xc7d24b5e; + d = a | -2; + b = (d == 0) ? c : (c % d); + if (b != c) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41919.c b/gcc/testsuite/gcc.c-torture/execute/pr41919.c new file mode 100644 index 00000000000..4ca09141b5e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41919.c @@ -0,0 +1,39 @@ +extern void abort (void); + +#define assert(x) if(!(x)) abort() + +struct S1 +{ + char f0; +}; + +int g_23 = 0; + +static struct S1 +foo (void) +{ + int *l_100 = &g_23; + int **l_110 = &l_100; + struct S1 l_128 = { 1 }; + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + assert (l_100 == &g_23); + return l_128; +} + +static char bar(char si1, char si2) +{ + return (si1 <= 0) ? si1 : (si2 * 2); +} +int main (void) +{ + struct S1 s = foo(); + if (bar(0x99 ^ (s.f0 && 1), 1) != -104) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41935.c b/gcc/testsuite/gcc.c-torture/execute/pr41935.c new file mode 100644 index 00000000000..ef8d08ce023 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41935.c @@ -0,0 +1,25 @@ +/* PR middle-end/41935 */ + +extern void abort (void); + +long int +foo (int n, int i, int j) +{ + typedef int T[n]; + struct S { int a; T b[n]; }; + return __builtin_offsetof (struct S, b[i][j]); +} + +int +main (void) +{ + typedef int T[5]; + struct S { int a; T b[5]; }; + if (foo (5, 2, 3) + != __builtin_offsetof (struct S, b) + (5 * 2 + 3) * sizeof (int)) + abort (); + if (foo (5, 5, 5) + != __builtin_offsetof (struct S, b) + (5 * 5 + 5) * sizeof (int)) + abort (); + return 0; +} |