Compiling with -O2 the following creates invalid virtual operands after SRA:
struct Foo { int a; int b; }; Foo foo(Foo p, bool ret_first) { Foo first = p; Foo last = p; return ret_first ? first : last; } # iftmp.0D.1761_1 = PHI <&firstD.1740(1), &lastD.1757(0)>; <L2>:; # VUSE <SFT.6D.1783_24>; # VUSE <SFT.8D.1785_26>; SR.26D.1803_27 = iftmp.0D.1761_1->bD.1735; # VUSE <SFT.6D.1783_24>; # VUSE <SFT.8D.1785_26>; SR.25D.1802_28 = iftmp.0D.1761_1->aD.1734; the access to ->b should VUSE SFTs 5 and 7. -- Summary: [4.1 Regression] Wrong alias information for SRAed struct copy Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: wrong-code, alias Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26258