diff options
-rw-r--r-- | gcc/testsuite/gcc.dg/pr106938.c | 36 | ||||
-rw-r--r-- | gcc/tree-cfg.cc | 13 |
2 files changed, 43 insertions, 6 deletions
diff --git a/gcc/testsuite/gcc.dg/pr106938.c b/gcc/testsuite/gcc.dg/pr106938.c new file mode 100644 index 0000000..7365a8c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr106938.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-ipa-pure-const -fno-tree-ccp -Wuninitialized" } */ + +int n; + +void +undefined (void); + +__attribute__ ((returns_twice)) int +zero (void) +{ + return 0; +} + +void +bar (int) +{ + int i; + + for (i = 0; i < -1; ++i) + n = 0; +} + +__attribute__ ((simd)) void +foo (void) +{ + int uninitialized; + + undefined (); + + while (uninitialized < 1) /* { dg-warning "uninitialized" } */ + { + bar (zero ()); + ++uninitialized; + } +} diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 41ce1b2..53be0c2 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -9836,16 +9836,12 @@ execute_fixup_cfg (void) int flags = gimple_call_flags (stmt); if (flags & (ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE)) { - if (gimple_purge_dead_abnormal_call_edges (bb)) - todo |= TODO_cleanup_cfg; - if (gimple_in_ssa_p (cfun)) { todo |= TODO_update_ssa | TODO_cleanup_cfg; update_stmt (stmt); } } - if (flags & ECF_NORETURN && fixup_noreturn_call (stmt)) todo |= TODO_cleanup_cfg; @@ -9875,10 +9871,15 @@ execute_fixup_cfg (void) } } - if (maybe_clean_eh_stmt (stmt) + gsi_next (&gsi); + } + if (gimple *last = last_stmt (bb)) + { + if (maybe_clean_eh_stmt (last) && gimple_purge_dead_eh_edges (bb)) todo |= TODO_cleanup_cfg; - gsi_next (&gsi); + if (gimple_purge_dead_abnormal_call_edges (bb)) + todo |= TODO_cleanup_cfg; } /* If we have a basic block with no successors that does not |