Commit regression test distilled from 20963

From-SVN: r98222
This commit is contained in:
Daniel Berlin 2005-04-16 02:52:16 +00:00
parent 16c35a1fdc
commit 83eba8781a
1 changed files with 23 additions and 0 deletions

View File

@ -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;
}
};