diff options
author | daney <daney@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-25 20:20:59 +0000 |
---|---|---|
committer | daney <daney@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-25 20:20:59 +0000 |
commit | 616b875f3e877e13c8ed17204b2c208bd6769e31 (patch) | |
tree | 50bc9f05a47650fd5770e4d73e9ea1350eda9775 | |
parent | 6f4274f96edf36ee6fc7721f3d048aeead46cc5c (diff) | |
download | gcc-616b875f3e877e13c8ed17204b2c208bd6769e31.tar.gz |
2009-07-25 David Daney <ddaney@caviumnetworks.com>
* cfgcleanup.c (old_insns_match_p): Handle the case of empty
blocks.
2009-07-25 David Daney <ddaney@caviumnetworks.com>
* gcc.dg/builtin-unreachable-4.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150089 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cfgcleanup.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtin-unreachable-4.c | 14 |
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e223f448a75..54806d15543 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-07-25 David Daney <ddaney@caviumnetworks.com> + + * cfgcleanup.c (old_insns_match_p): Handle the case of empty + blocks. + 2009-07-25 Martin Jambor <mjambor@suse.cz> * c-common.c (c_common_attribute_table): New element for noclone. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 757a0ffe4ca..01ddf999ed3 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -953,7 +953,12 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2) if (GET_CODE (i1) != GET_CODE (i2)) return false; - p1 = PATTERN (i1); + /* __builtin_unreachable() may lead to empty blocks (ending with + NOTE_INSN_BASIC_BLOCK). They may be crossjumped. */ + if (NOTE_INSN_BASIC_BLOCK_P (i1) && NOTE_INSN_BASIC_BLOCK_P (i2)) + return true; + + p1 = PATTERN (i1); p2 = PATTERN (i2); if (GET_CODE (p1) != GET_CODE (p2)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c0136282661..c982c253e36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-07-25 David Daney <ddaney@caviumnetworks.com> + + * gcc.dg/builtin-unreachable-4.c: New test. + 2009-07-25 Tobias Burnus <burnus@net-b.de> PR fortran/33197 diff --git a/gcc/testsuite/gcc.dg/builtin-unreachable-4.c b/gcc/testsuite/gcc.dg/builtin-unreachable-4.c new file mode 100644 index 00000000000..90bc99cbe2d --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-unreachable-4.c @@ -0,0 +1,14 @@ +/* Check that this valid code doesn't ICE. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +void +g (int a, int b, int c, int d) +{ + if (d) + { + ((void) + (!(a && b && c) ? __builtin_unreachable (), 0 : 0)); + } + ((void) + (!(a && b && c) ? __builtin_unreachable (), 0 : 0)); +} |