http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55579
Bug #: 55579 Summary: SRA doesn't create debug stmts when they would be useful Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org CC: jamb...@gcc.gnu.org Consider -g -O2: struct S { int a; char b; char c; short d; }; int foo (int x) { struct S s = { x + 1, x + 2, x + 3, x + 4 }; char *p = &s.c; return x; } Unfortunately, SRA doesn't add here any debug stmts and everything is DSEd later on. *.esra dump says: Candidate (1722): s Marking s offset: 0, size: 32 to be replaced with debug statements. Marking s offset: 32, size: 8 to be replaced with debug statements. Marking s offset: 40, size: 8 to be replaced with debug statements. Marking s offset: 48, size: 16 to be replaced with debug statements. ! Disqualifying s - No scalar replacements to be created. If there are just debug replacements, no normal ones, and the aggregate still has been candidate for SRA (i.e. no address escape, etc.), it would be nice if the debug replacements could be emitted anyway. CDDCE or DSE will then remove the actual stmts, but debug info will be accurate.