diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr89505.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr89505.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr89505.c b/gcc/testsuite/gcc.dg/torture/pr89505.c new file mode 100644 index 00000000000..6fca475ad9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89505.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +struct S { int i; void *p; int j; }; +int a; +int __attribute__((noinline)) +foo (struct S * __restrict p, int q) +{ + int *x = &p->j; + if (q) + x = &a; + p->j = 1; + *x = 2; + return p->j; +} + +int main() +{ + struct S s; + if (foo (&s, 0) != 2) + __builtin_abort (); + return 0; +} |