Commit regression test distilled from 20963
authorDaniel Berlin <dberlin@gcc.gnu.org>
Sat, 16 Apr 2005 02:52:16 +0000 (02:52 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Sat, 16 Apr 2005 02:52:16 +0000 (02:52 +0000)
From-SVN: r98222

gcc/testsuite/g++.dg/tree-ssa/pr20963.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr20963.C b/gcc/testsuite/g++.dg/tree-ssa/pr20963.C
new file mode 100644 (file)
index 0000000..d8f91e1
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* This was causing PRE to insert the value of the ADDR variable, to 
+   remove the invariant cast but in doing so, it was creating a 
+   non-invariant expression out of the invariant one, causing a later 
+   failure in PRE.  */ 
+struct sMCB { 
+  unsigned char type; 
+}; 
+extern void foo (void); 
+unsigned char mem_readb(char *pt) __attribute__((nothrow)); 
+void DOS_FreeProcessMemory(unsigned short pspseg) { 
+        while (1) { 
+                if (pspseg) 
+                        foo (); 
+                char *addr = (char*)(&((sMCB*)0)->type); 
+                if (mem_readb(addr)==0x5a) break; 
+        } 
+};