Issue 133671
Summary [Flang] Compilation error of interface and end interface statement with read (formatted) as defined-io-generic-spec
Labels flang
Assignees
Reporter 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:
```fortran
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
$
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to