https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102864
Bug ID: 102864 Summary: no out of bounds warning for DCE code Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: int f(void) { int t[4]={0,0,0,0}; int t2 = 5; int tt, tt1; tt = t[t2]; tt1 = tt; return tt-tt1; } There is no out of bounds warning for the t[t2] access because the code is all dead.