Hi Harald, It looks good to me. OK for mainline. You might even consider backporting to 11-branch.
Best regards Paul On Fri, 27 Aug 2021 at 21:15, Harald Anlauf via Fortran <fort...@gcc.gnu.org> wrote: > Dear all, > > the ICE in the original testcase does no longer occur but leads to an > error in a later stage of compilation, and we accepted invalid code. > (Cross-checked with other compilers, such as Intel and NAG). > > F2018 states: > > 15.6.2.6 ENTRY statement > > (3) ... If the characteristics of the result of the function named in the > ENTRY statement are the same as the characteristics of the result of the > function named in the FUNCTION statement, their result names identify the > same > entity, although their names need not be the same. Otherwise, they are > storage > associated and shall all be nonpointer, nonallocatable scalar variables > that > are default integer, default real, double precision real, default complex, > or > default logical. > > We thus better reject the testcase example during resolution with an > appropriate error message. (I hope the chosen one is fine enough.) > > Regtested on x86_64-pc-linux-gnu. OK for mainline? > > Thanks, > Harald > > > Fortran - reject function entries with mismatched characteristics > > gcc/fortran/ChangeLog: > > PR fortran/87737 > * resolve.c (resolve_entries): For functions of type CHARACTER > tighten the checks for matching characteristics. > > gcc/testsuite/ChangeLog: > > PR fortran/87737 > * gfortran.dg/entry_24.f90: New test. > > -- "If you can't explain it simply, you don't understand it well enough" - Albert Einstein