On Mon, Nov 20, 2023 at 03:33:31PM +0100, Sebastian Huber wrote: > This change fixes issues like this: > > gcc.dg/gomp/pr27573.c: In function ‘main._omp_fn.0’: > gcc.dg/gomp/pr27573.c:19:1: error: non-trivial conversion in ‘ssa_name’ > 19 | } > | ^ > long int > long unsigned int > # .MEM_19 = VDEF <.MEM_18> > __gcov7.main._omp_fn.0[0] = PROF_time_profile_12; > during IPA pass: profile > gcc.dg/gomp/pr27573.c:19:1: internal compiler error: verify_gimple failed > > gcc/ChangeLog: > > PR middle-end/112634 > > * tree-profile.cc (gen_assign_counter_update): Cast the unsigned result > type of > __atomic_add_fetch() to the signed counter type. > --- > gcc/tree-profile.cc | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc > index 68db09f6189..54938e1d165 100644 > --- a/gcc/tree-profile.cc > +++ b/gcc/tree-profile.cc > @@ -284,7 +284,9 @@ gen_assign_counter_update (gimple_stmt_iterator *gsi, > gcall *call, tree func, > tree tmp = make_temp_ssa_name (result_type, NULL, name); > gimple_set_lhs (call, tmp); > gsi_insert_after (gsi, call, GSI_NEW_STMT); > - gassign *assign = gimple_build_assign (result, tmp); > + gassign *assign = gimple_build_assign (result, > + build_int_cst (TREE_TYPE (result), > + tmp));
This can't be correct. tmp is a SSA_NAME, so calling build_int_cst on it is not appropriate, the second argument should be some unsigned HOST_WIDE_INT value. If result_type is different type from TREE_TYPE (result), but both are integer types, then you want gassign *assing = gimple_build_assign (result, NOP_EXPR, tmp); or so. Jakub