On Sun, Mar 23, 2014 at 1:02 PM, Eric Botcazou <ebotca...@adacore.com> wrote: > This is a regression present on mainline and 4.8 branch: ifcvt generates a > conditional move from an invalid location on the stack, resulting in a > segfault at runtime. The testcase is pathological and exploits the very old > RTL semantics (now embodied in may_trap_or_fault_p) of considering that stack > references cannot trap, which is of course wrong for nonsensical offsets. > > This is an old issue (the attached testcase distilled by Jakub already fails > with GCC 4.3) and the original testcase is clearly machine-generated, so I > don't think that we need to pessimize the common case for it; instead fixing > this kind of very minor issues on a case-by-case basis is good enough I think. > > The attached patch only adds a check in rtx_addr_can_trap_p_1 for nonsensical > offsets against the frame pointer; this is sufficient for both testcases. The > check is supposed to be exact (e.g. it never triggers during a bootstrap) so > it won't pessimize anything. This might be different if the ??? comment is > addressed later but, again, I don't think that we should care at this point. > > Tested on x86_64-suse-linux, any objections?
Looks reasonable to me. Richard. > > 2014-03-23 Eric Botcazou <ebotca...@adacore.com> > > PR rtl-optimization/60452 > * rtlanal.c (rtx_addr_can_trap_p_1): Fix head comment. > <case REG>: Return 1 for nonsensical offsets from the frame pointer. > > > 2014-03-23 Eric Botcazou <ebotca...@adacore.com> > > * gcc.c-torture/execute/20140323-1.c: New test. > > > -- > Eric Botcazou