1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 
4 /* This was causing PRE to insert the value of the ADDR variable, to
5    remove the invariant cast but in doing so, it was creating a
6    non-invariant expression out of the invariant one, causing a later
7    failure in PRE.  */
8 struct sMCB {
9   unsigned char type;
10 };
11 
12 extern void foo (void);
13 unsigned char mem_readb(char *pt) __attribute__((nothrow));
14 
DOS_FreeProcessMemory(unsigned short pspseg)15 void DOS_FreeProcessMemory(unsigned short pspseg) {
16         while (1) {
17                 if (pspseg)
18                         foo ();
19                 char *addr = (char*)(&((sMCB*)0)->type);
20                 if (mem_readb(addr)==0x5a) break;
21         }
22 };
23 
24