https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95366

            Bug ID: 95366
           Summary: TYPE IS(character(*)) no longer matches
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at abeckmann dot de
  Target Milestone: ---

Created attachment 48618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48618&action=edit
2 modules and a main program that demonstrate the bug

This is a regression in gfortran-10: in some cases 
  SELECT TYPE (arg)
  TYPE IS(CHARACTER(*))
    ...
  CLASS DEFAULT
    ...
does not match a polymorphic (class(*)) argument as character but falls through
to the class default, even though the subroutine was called with a
character(len=42) argument. This bug seems require caller and callee residing
in different modules (i.e. different compilation units).

A test case is attached:

gfortran-10 -W -Wall -Wextra  -c -o mod1.o mod1.f90
gfortran-10 -W -Wall -Wextra  -c -o mod2.o mod2.f90
gfortran-10 -W -Wall -Wextra  -c -o main.o main.f90
gfortran-10 main.o mod1.o mod2.o
./a.out
 int
 unknown

while building with gfortran-9 works:

gfortran-9 -W -Wall -Wextra  -c -o mod1.o mod1.f90
gfortran-9 -W -Wall -Wextra  -c -o mod2.o mod2.f90
gfortran-9 -W -Wall -Wextra  -c -o main.o main.f90
gfortran-9 main.o mod1.o mod2.o
./a.out
 int
 char

I observed this with the Debian 10.1.0-2 build (corresponding to git as of
20200515) and I could confirm it with git master
(6c8e16aea85286721eb5689f9bcae09d36003cb1).

Reply via email to