Skip to content

[Flang] Compilation error of interface and end interface statement with read (formatted) as defined-io-generic-spec #133671

@ohno-fj

Description

@ohno-fj
Version of flang : 21.0.0(b2b3cb5f76f15d38e67f70124d275a5696bfdb83)/AArch64

interface and end interface statement with read (formatted) as defined-io-generic-spec fails the linker command.
When read (formatted) is removed from interface and end interface statement, the compilation is successful.

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

sngg521n_21.f90:

PROGRAM MAIN
  TYPE T
     INTEGER::A
  END TYPE T
  INTERFACE READ(FORMATTED)
     SUBROUTINE SUB1 (DTV, UNIT, IOTYPE, V_LIST, IOSTAT, IOMSG)
       IMPORT T
       CLASS(T), INTENT(INOUT)         :: DTV
       INTEGER, INTENT(IN)             :: UNIT
       CHARACTER(LEN=*), INTENT(IN)    :: IOTYPE
       INTEGER, INTENT(IN)             :: V_LIST (:)
       INTEGER, INTENT(OUT)            :: IOSTAT
       CHARACTER(LEN=*), INTENT(INOUT) :: IOMSG
     END SUBROUTINE SUB1
  END INTERFACE READ(FORMATTED)
  print *,'pass'
END PROGRAM MAIN
$ flang sngg521n_21.f90
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/aarch64-redhat-linux/12/../../../../bin/ld: /tmp/sngg521n_21-1789ed.o:(.data.rel.ro._QFEXsXt[_QFEXsXt]+0x8): undefined reference to `sub1_'
flang-20: error: linker command failed with exit code 1 (use -v to see invocation)
$
$ gfortran sngg521n_21.f90; ./a.out
 pass
$
$ ifx sngg521n_21.f90; ./a.out
 pass
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    flangFlang issues not falling into any other categoryquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions