From 3795b582ace1a4d050c21e5ea0ae29e69b5fbde1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 24 Apr 2019 10:14:50 +0200 Subject: [PATCH] re PR tree-optimization/90208 (error: EH landing pad label) PR tree-optimization/90208 * tree-cfg.c (remove_bb): Move forced labels from removed bbs after labels of new_bb, not before them. * gcc.dg/tsan/pr90208-1.c: New test. * gcc.dg/tsan/pr90208-2.c: New test. From-SVN: r270534 --- gcc/ChangeLog | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/tsan/pr90208-1.c | 5 +++++ gcc/testsuite/gcc.dg/tsan/pr90208-2.c | 20 ++++++++++++++++++++ gcc/tree-cfg.c | 2 +- 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tsan/pr90208-1.c create mode 100644 gcc/testsuite/gcc.dg/tsan/pr90208-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d4af0fd1724..e098504f081 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-04-24 Jakub Jelinek + PR tree-optimization/90208 + * tree-cfg.c (remove_bb): Move forced labels from removed bbs + after labels of new_bb, not before them. + PR tree-optimization/90211 * tree-parloops.c (try_create_reduction_list): Ignore phi arguments which are not SSA_NAMEs. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b301146a5f8..73b34e07113 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2019-04-24 Jakub Jelinek + PR tree-optimization/90208 + * gcc.dg/tsan/pr90208-1.c: New test. + * gcc.dg/tsan/pr90208-2.c: New test. + PR tree-optimization/90211 * gcc.dg/autopar/pr90211.c: New test. diff --git a/gcc/testsuite/gcc.dg/tsan/pr90208-1.c b/gcc/testsuite/gcc.dg/tsan/pr90208-1.c new file mode 100644 index 00000000000..528c3b0e5ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/pr90208-1.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/90208 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fexceptions -fsanitize=thread" } */ + +#include "../../gcc.c-torture/compile/pr89280.c" diff --git a/gcc/testsuite/gcc.dg/tsan/pr90208-2.c b/gcc/testsuite/gcc.dg/tsan/pr90208-2.c new file mode 100644 index 00000000000..c3823d0a400 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/pr90208-2.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/90208 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fexceptions -fsanitize=thread" } */ + +void *b[5]; +void foo (void); + +void +bar (int d) +{ + while (d) + foo (); +} + +void +baz (void) +{ + bar (2); + __builtin_setjmp (b); +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 0dc94ea41d4..587408150fb 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2265,7 +2265,7 @@ remove_bb (basic_block bb) new_bb = single_succ (new_bb); gcc_assert (new_bb != bb); } - new_gsi = gsi_start_bb (new_bb); + new_gsi = gsi_after_labels (new_bb); gsi_remove (&i, false); gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT); } -- 2.30.2