aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/Regression/C/gcc-c-torture/execute/20030913-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/20030913-1.c')
-rw-r--r--SingleSource/Regression/C/gcc-c-torture/execute/20030913-1.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/20030913-1.c b/SingleSource/Regression/C/gcc-c-torture/execute/20030913-1.c
new file mode 100644
index 00000000..201fdbba
--- /dev/null
+++ b/SingleSource/Regression/C/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);
+}