From: Harald Anlauf Date: Tue, 28 Jan 2025 20:21:40 +0000 (+0100) Subject: Fortran: fix passing of component ref to assumed-rank dummy [PR118683] X-Git-Tag: releases/gcc-14.3.0~538 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b53d19a152cacfb4fcd1abb130d24a1c5dcaef15;p=thirdparty%2Fgcc.git Fortran: fix passing of component ref to assumed-rank dummy [PR118683] While the fix for pr117774 addressed the passing of an inquiry reference to an assumed-rank dummy, it missed the similar case of passing a component reference. The newer testcase gfortran.dg/pr81978.f90 uncovered this latent issue with a UBSAN instrumented compiler. PR fortran/118683 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_procedure_call): The bounds update for passing to assumed-rank dummies shall also handle component references besides inquiry references. (cherry picked from commit 5d001fa122bf04cfd0611ff7723969a0421b3094) --- diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 1efe435f397..601cc546d43 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -7254,6 +7254,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, { if (ref->next->type == REF_INQUIRY) break; + if (ref->type == REF_ARRAY + && ref->u.ar.type != AR_ELEMENT) + break; }; if (ref->u.ar.type == AR_FULL && ref->u.ar.as->type != AS_ASSUMED_SIZE)