http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60452
--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > But even if I try: > int a; > __attribute__((noinline, noclone)) void > foo (int *e) > { > asm volatile ("" : : "r" (e) : "memory"); > } > > int > main () > { > int e[2] = { 0, 0 }, f = 0; > if (a == 131072) > f = e[a]; > foo (e); > return f; > } > where we have: > (mem:SI (plus:DI (reg/f:DI 20 frame) > (const_int 524272 [0x7fff0])) [2 e+524288 S4 A128]) > instead and thus from MEM_EXPR we perhaps could find out that it is an out > of bound access, we still always treat all frame based accesses (whatever > the offset is) as non-trapping. > So perhaps we need to handle known out of bound MEMs specially when we find > that fact out (if we want to emit them into the RTL IL at all), one thing is > expansion, another thing if say initially non-constant offset is later > CSEd/forwprop etc. into constant out of bound offset. > > Thoughts? Again quite an artificial testcase... What about adding a comparison of the offset with the result of get_frame_size if the base register is SFP/HFP/SP?