aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/pr20963.C
blob: d8f91e1be3153f759064c0bf28b5efea4d82f93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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; 
        } 
};