https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119656
Bug ID: 119656 Summary: [12/13/14/15 Regression] Wrong code with impure elemental subroutine and interface Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: anlauf at gcc dot gnu.org Target Milestone: --- The attached code is derived from: https://fortran-lang.discourse.group/t/problem-with-impure-elemental-subroutine-in-interface-with-gfortran/9545 Compiled with gfortran 12+ I get: in foo_df, len(xstr) = 2 in foo_df, len(xstr) = 0 while with version 7-11 I get the correct: in foo_df, len(xstr) = 2 in foo_df, len(xstr) = 2 Remarks: - as noted in the above discussion, commenting 'use m1_mod' avoids the issue - impure AND elemental are needed to reproduce - the dump tree shows that the failing translated calls has a wrong number of arguments: void MAIN__ () { { static integer(kind=4) C.4688 = 5; foo_df (&C.4688, 0B, &"ab"[1]{lb: 1 sz: 1}, 2); } { static integer(kind=4) C.4689 = 5; foo_df (&C.4689, 0B, &"ab"[1]{lb: 1 sz: 1}, 0, 2); } } The additional 0 in the argument list is taken as string length.