[PATCH/RFC] Fix PR optimization/11304
Eric Botcazou
ebotcazou@libertysurf.fr
Wed Jun 25 00:18:00 GMT 2003
Hi,
This is a regression from GCC 3.0.4, present in all released versions since
then but already fixed on mainline. The function
int hux(int x)
{
if (x)
{
set_eax(0);
return x;
}
foo(x);
}
is miscompiled at -O -fomit-frame-pointer on x86: if x is not null, the
function will return 0 anyway, because it fails to restore %eax after the
call to set_eax().
The problem comes from the cross-jumping pass: it considers that the
predecessors of two edges with the same destination block share common code.
Now the first one sets %eax, while the second one only clobbers %eax. So we
end up with a SET before a CLOBBER and the SET is deleted.
This was recently fixed on mainline by
2003-04-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* cfgcleanup.c (flow_find_cross_jump): Use INSN_P, not active_insn_p.
but Jan seemed to have some reserve:
http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01445.html
http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01482.html
Is this patch appropriate for a backport? Do we want to fix the bug on the
3.3 branch?
--
Eric Botcazou
2003-06-24 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11304
Backport from mainline:
2003-04-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* cfgcleanup.c (flow_find_cross_jump): Use INSN_P, not active_insn_p.
2003-06-24 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/i386-call-1.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr11304.diff
Type: text/x-diff
Size: 1777 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030625/2935414b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i386-call-1.c
Type: text/x-csrc
Size: 527 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030625/2935414b/attachment-0001.bin>
More information about the Gcc-patches
mailing list