http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60452

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Eric Botcazou from comment #6)
> > 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?

But what would be safe positive/negative offsets from frame_pointer?
I mean, e.g. size of arguments is not included in the frame size, so size of
arguments would need to be taken into account too, plus does the middle-end
really know all the biases etc.?

Reply via email to