[FLANG] Flang fails to catch the error of DATA statement in INTERFACE body
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Based on C1506 (R1505) An interface-body shall not contain a data-stmt,... (Fortran standard 2023), compiling the following code should produce an error of something like "DATA statement in INTERFACE body is not allowed". But flang shows "not yet implemented". Here are the results from different compilers:
`% cat tst.f90`
```fortran
program p
interface
subroutine foo(x)
integer :: x, y
data y /1/
end subroutine foo
end interface
integer :: x
call foo(x)
end program p
```
```console
% flang tst.f90 -c
error: loc("/home/users/laos/llvm-flang/src/llvm-tst90/tst.f90":5:12): /home/users/laos/llvm-flang/src/llvm-project/flang/lib/Lower/ConvertVariable.cpp:613: not yet implemented: global
LLVM ERROR: aborting
ftn tst.f90 -c
data y /1/
^
ftn-271 ftn: ERROR FOO, File = tst.f90, Line = 5, Column = 7
The DATA statement is not allowed in an interface body.
Cray Fortran : 10 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
Cray Fortran : "explain ftn-message number" gives more information about each message.
% gfortran-15 tst.f90 -c
tst.f90:5:11:
5 | data y /1/
| 1
Error: DATA statement at (1) cannot appear within an INTERFACE
% ifx tst.f90 -c
tst.f90(5): error #6622: This statement is invalid in an INTERFACE block.
data y /1/
------^
compilation aborted for tst.f90 (code 1)
```
Contributor guide
Assessment
This issue has not been assessed yet.