This test case was extracted from kernel source exposed in some older
version of gcc. Works fine in trunk, but need to add a test for it.

Ok for trunk?

Thanks,

David
Index: testsuite/gcc.dg/tree-ssa/integer-addr.c
===================================================================
--- testsuite/gcc.dg/tree-ssa/integer-addr.c	(revision 0)
+++ testsuite/gcc.dg/tree-ssa/integer-addr.c	(revision 0)
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized -fno-strict-aliasing" } */
+/* Test with fixed address */
+static int *foo =  (int *) (unsigned long) 0x7800000;
+
+int func(void) __attribute__ ((noinline));
+
+extern int bar(void);
+
+int func(void)
+{
+   if (*foo) {
+      return 1;
+   }
+   return 0;
+
+}
+
+int foobar(void)
+{
+
+   if (func()) {
+      *foo = 1;
+   }
+   return func();
+}
+
+/* { dg-final { scan-tree-dump-times "= func" 2 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 173176)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2011-04-29  Xinliang David Li  <davi...@google.com>
+	
+	* gcc.dg/tree-ssa/integer-addr.c: New test.
+
 2011-04-29  Tobias Burnus  <bur...@net-b.de>
 
 	PR fortran/48810

Reply via email to