summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20030913-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/20030913-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030913-1.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030913-1.c b/gcc/testsuite/gcc.c-torture/execute/20030913-1.c
new file mode 100644
index 00000000000..5e33f50f560
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20030913-1.c
@@ -0,0 +1,26 @@
+/* Assignments via pointers pointing to global variables were being killed
+ by SSA-DCE. Test contributed by Paul Brook <paul@nowt.org> */
+
+int glob;
+
+void
+fn2(int ** q)
+{
+ *q = &glob;
+}
+
+void test()
+{
+ int *p;
+
+ fn2(&p);
+
+ *p=42;
+}
+
+int main()
+{
+ test();
+ if (glob != 42) abort();
+ exit (0);
+}