aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20080604-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20080604-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20080604-1.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20080604-1.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20080604-1.c
new file mode 100644
index 000000000..5ba35cb2c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20080604-1.c
@@ -0,0 +1,32 @@
+struct barstruct { char const* some_string; } x;
+extern void abort (void);
+void __attribute__((noinline))
+foo(void)
+{
+ if (!x.some_string)
+ abort ();
+}
+void baz(int b)
+{
+ struct barstruct bar;
+ struct barstruct* barptr;
+ if (b)
+ barptr = &bar;
+ else
+ {
+ barptr = &x + 1;
+ barptr = barptr - 1;
+ }
+ barptr->some_string = "Everything OK";
+ foo();
+ barptr->some_string = "Everything OK";
+}
+int main()
+{
+ x.some_string = (void *)0;
+ baz(0);
+ if (!x.some_string)
+ abort ();
+ return 0;
+}
+