Undefined ranges have no type. This patch fixes the thinko. gcc/ChangeLog:
PR middle-end/115128 * ipa-cp.cc (ipa_value_range_from_jfunc): Check for undefined_p before looking at type. (propagate_vr_across_jump_function): Same. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr115128.c: New test. --- gcc/ipa-cp.cc | 4 +++ gcc/testsuite/gcc.dg/tree-ssa/pr115128.c | 31 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr115128.c diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index 09cab761822..408166b8044 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -1744,6 +1744,8 @@ ipa_value_range_from_jfunc (vrange &vr, pointer type to hold the result instead of a boolean type. Avoid trapping in the sanity check in fold_range until this is fixed. */ + || srcvr.undefined_p () + || op_vr.undefined_p () || !handler.operand_check_p (vr_type, srcvr.type (), op_vr.type ()) || !handler.fold_range (op_res, vr_type, srcvr, op_vr)) op_res.set_varying (vr_type); @@ -2556,6 +2558,8 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc, pointer type to hold the result instead of a boolean type. Avoid trapping in the sanity check in fold_range until this is fixed. */ + || src_lats->m_value_range.m_vr.undefined_p () + || op_vr.undefined_p () || !handler.operand_check_p (operand_type, src_lats->m_value_range.m_vr.type (), op_vr.type ()) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr115128.c b/gcc/testsuite/gcc.dg/tree-ssa/pr115128.c new file mode 100644 index 00000000000..14bd4dbd6e5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr115128.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -w" } */ + +long XXH3_len_4to8_64b_len, XXH3_len_0to16_64b___trans_tmp_3, XXH3_mix2Accs_acc, + XXH3_64bits_internal___trans_tmp_8; +typedef unsigned long XXH3_hashLong64_f(); +void *XXH3_64bits_internal_input; +int XXH3_64bits_internal___trans_tmp_1; +void XXH3_mul128_fold64(); +static void XXH3_mergeAccs(unsigned long) { + for (;;) + XXH3_mul128_fold64(XXH3_mix2Accs_acc); +} +static __attribute__((noinline)) unsigned long +XXH3_hashLong_64b_default(void *, unsigned long len) { + XXH3_mergeAccs(len * 7); +} +__attribute__((always_inline)) long +XXH3_64bits_internal(unsigned long len, XXH3_hashLong64_f f_hashLong) { + if (len <= 16) { + long keyed = + XXH3_64bits_internal___trans_tmp_1 ^ XXH3_len_0to16_64b___trans_tmp_3; + XXH3_mul128_fold64(keyed, XXH3_len_4to8_64b_len); + return XXH3_64bits_internal___trans_tmp_8; + } + f_hashLong(XXH3_64bits_internal_input, len); +} +static void XXH_INLINE_XXH3_64bits(unsigned long len) { + XXH3_64bits_internal(len, XXH3_hashLong_64b_default); +} +void __cmplog_rtn_hook() { XXH_INLINE_XXH3_64bits(sizeof(long)); } -- 2.45.0