Hi Jakub, Good catch! Does it fix any specific PR?
If you don't have the time, I would be happy to apply the correction to 13-branch through to mainline. Regards Paul On Thu, 14 Nov 2024 at 22:24, Jakub Jelinek <ja...@redhat.com> wrote: > On Thu, Nov 14, 2024 at 08:58:26PM +0100, Jan Hubicka wrote: > > fortran produces malloc call with signed size instead of unsigned. This > > in turn makes gimple_call_builtin_p to fail type checking and we do not > > treat the call as malloc call. > > > > regtested x86_64-linux, OK? > > > > gcc/fortran/ChangeLog: > > > > * trans-expr.cc (gfc_trans_subcomponent_assign): Convert malloc > > parameter to size_type. > > LGTM. > > > diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc > > index ddbb5ecf068..951ac26c4ea 100644 > > --- a/gcc/fortran/trans-expr.cc > > +++ b/gcc/fortran/trans-expr.cc > > @@ -9661,6 +9661,7 @@ gfc_trans_subcomponent_assign (tree dest, > gfc_component * cm, > > gfc_init_se (&se, NULL); > > gfc_conv_expr (&se, expr); > > size = size_of_string_in_bytes (cm->ts.kind, se.string_length); > > + size = fold_convert (size_type_node, size); > > tmp = build_call_expr_loc (input_location, > > builtin_decl_explicit > (BUILT_IN_MALLOC), > > 1, size); > > Jakub > >