Bug 35291 - Missing DCE for union fields
Summary: Missing DCE for union fields
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2008-02-22 06:50 UTC by davidxl
Modified: 2008-02-22 10:47 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-02-22 10:47:17


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description davidxl 2008-02-22 06:50:42 UTC
union U {
  struct C
   {
      char c[4];
   }cc;

   int ii;
} u ;

void foo(int i)
{
   u.cc.c[0] = 10; // Dead
   u.cc.c[1] = 10; // Dead too
   u.cc.c[i] = 10; // Dead too
   u.ii  = 20;
}
Comment 1 Richard Biener 2008-02-22 10:47:17 UTC
Confirmed.  A re-written DSE and introduction of MEM_REF will fix this.