diff options
author | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-07-03 07:20:49 +0000 |
---|---|---|
committer | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-07-03 07:20:49 +0000 |
commit | 6477b4dd86ea01974a436d46626597ad455935e7 (patch) | |
tree | 6b9e26dc612c92752cb02a9f4d674fe6ced5563f | |
parent | 86506bced1df38694695afd3711c35df31e06e1d (diff) | |
download | gcc-6477b4dd86ea01974a436d46626597ad455935e7.tar.gz |
Fix sigsegv in find_same_succ_bb
2017-07-03 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/81192
* tree-ssa-tail-merge.c (same_succ_flush_bb): Handle
BB_SAME_SUCC (bb) == NULL.
* gcc.dg/pr81192.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249893 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr81192.c | 22 | ||||
-rw-r--r-- | gcc/tree-ssa-tail-merge.c | 3 |
4 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64793d9a95f..7284fef2806 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/81192 + * tree-ssa-tail-merge.c (same_succ_flush_bb): Handle + BB_SAME_SUCC (bb) == NULL. + 2017-07-02 Jan Hubicka <hubicka@ucw.cz> * cfgrtl.c (rtl_verify_edges): Enable checking of profile_probability diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac9c6a63d61..dda405aa9e7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/81192 + * gcc.dg/pr81192.c: New test. + 2017-07-02 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran/eoshift_3.f90: New test. diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c new file mode 100644 index 00000000000..57eb4781d4d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81192.c @@ -0,0 +1,22 @@ +/* { dg-options "-Os -fdump-tree-pre-details" } */ + +unsigned a; +int b, c; + +static int +fn1 (int p1, int p2) +{ + return p1 > 2147483647 - p2 ? p1 : p1 + p2; +} + +void +fn2 (void) +{ + int j; + a = 30; + for (; a;) + for (; c; b = fn1 (j, 1)) + ; +} + +/* { dg-final { scan-tree-dump-times "(?n)find_duplicates: <bb .*> duplicate of <bb .*>" 1 "pre" } } */ diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index db836f7187f..e88072c1836 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -809,6 +809,9 @@ static void same_succ_flush_bb (basic_block bb) { same_succ *same = BB_SAME_SUCC (bb); + if (! same) + return; + BB_SAME_SUCC (bb) = NULL; if (bitmap_single_bit_set_p (same->bbs)) same_succ_htab->remove_elt_with_hash (same, same->hashval); |