diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-12-03 08:40:50 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-12-03 08:40:50 +0000 |
commit | 0ce2b2991c6cef3d65055cc06ad76aeffb3587a3 (patch) | |
tree | 8997fcdef589e56a8ca3d3a251a0bc0305892e4b /gcc | |
parent | 396315d951e6e0743fa9a55e9f8933e7fb5d1352 (diff) | |
download | gcc-0ce2b2991c6cef3d65055cc06ad76aeffb3587a3.zip gcc-0ce2b2991c6cef3d65055cc06ad76aeffb3587a3.tar.gz gcc-0ce2b2991c6cef3d65055cc06ad76aeffb3587a3.tar.bz2 |
re PR rtl-optimization/38281 (segmentation fault with optimization enabled)
PR rtl-optimization/38281
* combine.c (distribute_notes): When invoking SET_INSN_DELETED on i2,
set it to NULL_RTX afterwards.
* emit-rtl.c (set_insn_deleted): Fix formatting.
Co-Authored-By: Andrew Pinski <andrew_pinski@playstation.sony.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r142388
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/combine.c | 4 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20081203-1.c | 24 |
5 files changed, 44 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ee8dd8..a4afc7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2008-12-03 Eric Botcazou <ebotcazou@adacore.com> + Jakub Jelinek <jakub@redhat.com> + Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR rtl-optimization/38281 + * combine.c (distribute_notes): When invoking SET_INSN_DELETED on i2, + set it to NULL_RTX afterwards. + + * emit-rtl.c (set_insn_deleted): Fix formatting. + 2008-12-02 Richard Sandiford <rdsandiford@googlemail.com> * config/mips/mips.c (mips_expand_builtin): Fix the mode of the diff --git a/gcc/combine.c b/gcc/combine.c index b8a4335..d6f7480 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -12653,6 +12653,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, distribute_links (LOG_LINKS (tem)); SET_INSN_DELETED (tem); + if (tem == i2) + i2 = NULL_RTX; #ifdef HAVE_cc0 /* Delete the setter too. */ @@ -12668,6 +12670,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, distribute_links (LOG_LINKS (cc0_setter)); SET_INSN_DELETED (cc0_setter); + if (cc0_setter == i2) + i2 = NULL_RTX; } #endif } diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index ced4e58..0738f38 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3620,7 +3620,8 @@ add_insn_before (rtx insn, rtx before, basic_block bb) /* Replace insn with an deleted instruction note. */ -void set_insn_deleted (rtx insn) +void +set_insn_deleted (rtx insn) { df_insn_delete (BLOCK_FOR_INSN (insn), INSN_UID (insn)); PUT_CODE (insn, NOTE); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6d585a6..a1623c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-12-03 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/compile/20081203-1.c: New test. + 2008-12-02 Jason Merrill <jason@redhat.com> PR c++/35782, c++/37860 diff --git a/gcc/testsuite/gcc.c-torture/compile/20081203-1.c b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c new file mode 100644 index 0000000..713235f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20081203-1.c @@ -0,0 +1,24 @@ +/* PR rtl-optimization/38281 */ +/* Reporter: John Regehr <regehr@cs.utah.edu> */ +/* Testcase by Jakub Jelinek <jakub@redhat.com> */ + +inline unsigned short +foo (unsigned short x, unsigned short y) +{ + if (y == 0) + return x; + return x / y; +} + +unsigned short a, b, c; + +extern int baz (int, int); + +void +bar (void) +{ + int d = 0x3D75D162; + a = foo (b > d, baz (0, 1)); + for (c = 0; c; c = 1) + ; +} |