http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58169
Bug ID: 58169 Summary: missed load PRE related to array index truncation Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: amylaar at gcc dot gnu.org Created attachment 30664 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30664&action=edit test case for 32 bit targets gcc.dg/tree-ssa/ssa-pre-21.c fails for avr (which has 16 bit int and sizetype). The computation of k + 1L is done as unsigned int (16 bit), but later ++k is performed as unsigned long (32 bit), and thus array[k+1] is not re-used. The problem can also be seen on i686-pc-linux-gnu (32 bit) native by changing the testcase to do the index computations in 64 bit, as per attachment.