aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-05-22 14:33:21 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-05-22 14:33:21 +0000
commit5bf6d4abbb211815ea9389ed6c70d4e90530f8a3 (patch)
tree27e0f044c0ecbe72b17269761694c49334d6da95 /gcc
parent9d3a9de1ee02811717f605b56bb0064cad19a82e (diff)
downloadgcc-5bf6d4abbb211815ea9389ed6c70d4e90530f8a3.zip
gcc-5bf6d4abbb211815ea9389ed6c70d4e90530f8a3.tar.gz
gcc-5bf6d4abbb211815ea9389ed6c70d4e90530f8a3.tar.bz2
20080522-1.c: New testcase.
2008-05-22 Richard Guenther <rguenther@suse.de> * gcc.c-torture/execute/20080522-1.c: New testcase. From-SVN: r135768
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20080522-1.c43
2 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 51daefa..e954cd5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2008-05-22 Richard Guenther <rguenther@suse.de>
+ * gcc.c-torture/execute/20080522-1.c: New testcase.
+
+2008-05-22 Richard Guenther <rguenther@suse.de>
+
* gcc.dg/tree-ssa/alias-18.c: New testcase.
2008-05-22 Arnaud Charlet <charlet@adacore.com>
diff --git a/gcc/testsuite/gcc.c-torture/execute/20080522-1.c b/gcc/testsuite/gcc.c-torture/execute/20080522-1.c
new file mode 100644
index 0000000..75bc533
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20080522-1.c
@@ -0,0 +1,43 @@
+/* This testcase is to make sure we have i in referenced vars and that we
+ properly compute aliasing for the loads and stores. */
+
+extern void abort (void);
+
+static int i;
+static int *p = &i;
+
+int __attribute__((noinline))
+foo(int *q)
+{
+ *p = 1;
+ *q = 2;
+ return *p;
+}
+
+int __attribute__((noinline))
+bar(int *q)
+{
+ *q = 2;
+ *p = 1;
+ return *q;
+}
+
+int main()
+{
+ int j = 0;
+
+ if (foo(&i) != 2)
+ abort ();
+ if (bar(&i) != 1)
+ abort ();
+ if (foo(&j) != 1)
+ abort ();
+ if (j != 2)
+ abort ();
+ if (bar(&j) != 2)
+ abort ();
+ if (j != 2)
+ abort ();
+
+ return 0;
+}