diff --git a/gcc/testsuite/gcc.dg/pr116003.c b/gcc/testsuite/gcc.dg/pr116003.c new file mode 100644 index 00000000000..6021058a14e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr116003.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fnon-call-exceptions -fprofile-arcs -finstrument-functions -fno-tree-copy-prop" } */ + +_BitInt(5) b5; + +char c; +int i; +_BitInt(129) b129; + +void +foo(_BitInt(128) b128) +{ +l50: + b128 %= b128 - b129; +l64: + b128 %= c; + if (__builtin_add_overflow(i, 0, &c)) + goto l50; + if (__builtin_sub_overflow(c, 0, &b5)) + goto l64; +} diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index 9293d9ed65b..45722fcd13a 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -607,7 +607,11 @@ equiv_oracle::register_initial_def (tree ssa) if (SSA_NAME_IS_DEFAULT_DEF (ssa)) return; basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (ssa)); - gcc_checking_assert (bb && !find_equiv_dom (ssa, bb)); + + // If defining stmt is not in the IL, simply return. + if (!bb) + return; + gcc_checking_assert (!find_equiv_dom (ssa, bb)); unsigned v = SSA_NAME_VERSION (ssa); bitmap_set_bit (m_equiv_set, v);