http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49028
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.05.18 09:40:28 Ever Confirmed|0 |1 --- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-18 09:40:28 UTC --- I think we are confused by the division by the element size which is of course what the language semantic requires. Thus, we start with (void) ((this)->m_Cursor = (void * *) &(this)->m_Data + (long unsigned int) ((long unsigned int) ((((long int) ((this)->m_Cursor + 8) - (long int) &(this)->m_Data) /[ex] 8) % 16) * 8)) and because of the modulus we can't fold it. In the IL we end up with <bb 2>: D.2101_3 = this_1(D)->m_Cursor; D.2102_4 = D.2101_3 + 8; D.2103_5 = (long int) D.2102_4; D.2100_6 = &this_1(D)->m_Data; D.2104_7 = (long int) D.2100_6; D.2105_8 = D.2103_5 - D.2104_7; D.2106_9 = D.2105_8 /[ex] 8; D.2107_10 = D.2106_9 % 16; D.2108_11 = (long unsigned int) D.2107_10; D.2110_13 = &this_1(D)->m_Data[D.2108_11]{lb: 0 sz: 8}; this_1(D)->m_Cursor = D.2110_13; MEM[(void * *)this_1(D)].m_Data[D.2108_11]{lb: 0 sz: 8} = p_15(D); return; where it requires quite some elaboration to combine the D.2108_11 index computation with the address generation via the array-reference. Maybe we can do some generic clever tricks to (A /[ex] CST1) % CST2? We'd like to re-associate it somehow.