This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Don't eliminate insns that may trap
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 30 Sep 2002 18:46:07 +0100 (BST)
- Subject: Don't eliminate insns that may trap
A couple of places in the compiler incorrectly eliminate fetches that
may trap because their value isn't used. This is responsioble for one
of the few remaining Java test failures.
Andrew.
2002-09-30 Andrew Haley <aph@redhat.com>
* flow.c (insn_dead_p): When using non-call-exceptions, don't
eliminate insns that may trap.
* cse.c (insn_live_p): Likewise.
Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.237
diff -c -2 -p -r1.237 cse.c
*** cse.c 22 Sep 2002 02:03:17 -0000 1.237
--- cse.c 30 Sep 2002 17:43:53 -0000
*************** insn_live_p (insn, counts)
*** 7583,7587 ****
{
int i;
! if (GET_CODE (PATTERN (insn)) == SET)
return set_live_p (PATTERN (insn), insn, counts);
else if (GET_CODE (PATTERN (insn)) == PARALLEL)
--- 7583,7589 ----
{
int i;
! if (flag_non_call_exceptions && may_trap_p (insn))
! return true;
! else if (GET_CODE (PATTERN (insn)) == SET)
return set_live_p (PATTERN (insn), insn, counts);
else if (GET_CODE (PATTERN (insn)) == PARALLEL)
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.538
diff -c -2 -p -r1.538 flow.c
*** flow.c 22 Sep 2002 14:09:32 -0000 1.538
--- flow.c 30 Sep 2002 17:43:55 -0000
*************** insn_dead_p (pbi, x, call_ok, notes)
*** 2111,2114 ****
--- 2111,2118 ----
enum rtx_code code = GET_CODE (x);
+ /* Don't eliminate insns that may trap. */
+ if (flag_non_call_exceptions && may_trap_p (x))
+ return 0;
+
#ifdef AUTO_INC_DEC
/* As flow is invoked after combine, we must take existing AUTO_INC