On Wed, Jun 17, 2026 at 4:28 PM Martin Jambor <[email protected]> wrote: > > Hello, > > and ping please.
OK. Thanks, Richard. > Thanks, > > Martin > > > On Fri, Jun 05 2026, Martin Jambor wrote: > > Hi, > > > > function ipa_vr_intersect_with_arith_jfunc in ipa-cp.cc contains a > > check > > > > if (src_type == dst_type) > > > > which should have been > > > > if (operation_type == dst_type) > > > > which lead to an ICE in the ranger machinery as it tried to intersect > > a signed and an unsigned integer when compiling the testcases from > > PR124128. > > > > The condition itself is basically an early exit to avoid calling yet > > another ipa_vr_operation_and_type_effects to type-convert the value > > range when we already can simply compare the types and see we already > > have the righ thing. A better place for it is however just before > > that conversion, where it can also avoid the call when dealing with > > the most simple of pass-through jump functions (and where it generally > > "makes more sense") so this is what the patch does. > > > > gcc/ChangeLog: > > > > 2026-06-04 Martin Jambor <[email protected]> > > > > PR ipa/124128 > > * ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Move the check if > > the final type conversion needs to happen before the conversion. > > > > gcc/testsuite/ChangeLog: > > > > 2026-06-04 Martin Jambor <[email protected]> > > > > PR ipa/124128 > > * gcc.dg/ipa/pr124128.c: New test. > > --- > > gcc/ipa-cp.cc | 19 ++++++++++--------- > > gcc/testsuite/gcc.dg/ipa/pr124128.c | 19 +++++++++++++++++++ > > 2 files changed, 29 insertions(+), 9 deletions(-) > > create mode 100644 gcc/testsuite/gcc.dg/ipa/pr124128.c > > > > diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc > > index 9e0b698b8cb..628ffc325b1 100644 > > --- a/gcc/ipa-cp.cc > > +++ b/gcc/ipa-cp.cc > > @@ -1818,21 +1818,22 @@ ipa_vr_intersect_with_arith_jfunc (vrange &vr, > > if (!ipa_vr_operation_and_type_effects (op_res, src_vr, operation, > > operation_type, src_type)) > > return; > > - if (src_type == dst_type) > > - { > > - vr.intersect (op_res); > > - return; > > - } > > inter_vr = &op_res; > > src_type = operation_type; > > } > > else > > inter_vr = &src_vr; > > > > - value_range tmp_res (dst_type); > > - if (ipa_vr_operation_and_type_effects (tmp_res, *inter_vr, NOP_EXPR, > > - dst_type, src_type)) > > - vr.intersect (tmp_res); > > + if (src_type != dst_type) > > + { > > + value_range tmp_res (dst_type); > > + if (!ipa_vr_operation_and_type_effects (tmp_res, *inter_vr, > > NOP_EXPR, > > + dst_type, src_type)) > > + return; > > + vr.intersect (tmp_res); > > + } > > + else > > + vr.intersect (*inter_vr); > > return; > > } > > > > diff --git a/gcc/testsuite/gcc.dg/ipa/pr124128.c > > b/gcc/testsuite/gcc.dg/ipa/pr124128.c > > new file mode 100644 > > index 00000000000..e41f0d56bfd > > --- /dev/null > > +++ b/gcc/testsuite/gcc.dg/ipa/pr124128.c > > @@ -0,0 +1,19 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-O2 -fno-early-inlining" } */ > > + > > +typedef int blasint; > > +void blas_level1_thread(long); > > +void cblas_sscal(blasint, float, float, blasint incx) { > > + blas_level1_thread(incx); > > +} > > +blasint c_api_check_saxpby_n; > > +float c_api_check_saxpby_beta; > > +long labs(long); > > +static void c_api_check_saxpby(blasint incy) { > > + blasint incy_abs = labs(incy); > > + cblas_sscal(c_api_check_saxpby_n, c_api_check_saxpby_beta, 0, incy_abs); > > +} > > +void __ctest_saxpby_c_api_inc_x_2_inc_y_1_N_100_run() { > > + c_api_check_saxpby(1); > > + c_api_check_saxpby(2); > > +} > > -- > > 2.54.0
