Issue |
136521
|
Summary |
[Flang] No error checking when derived type is not interoperable because derived type has no BIND attribute
|
Labels |
flang:frontend
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(ebba554a3211b0b98d3ae33ba70f9d6ceaab6ad4)/AArch64
```
The attached program is not correct.
In this program, 'derived type (ss)' is not interoperable because 'derived type (ty1)' has no BIND attribute.
'Fortran standard 2023: 18.3.4 Interoperability of derived types and C structure types/C1806'.
However, flang does not detect any errors and the compilation succeeds.
Gfortran and ifx detect errors and both result in compilation errors.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
snfm1102_err003_3.f90:
```fortran
program main
type:: ty1
integer :: iii
end type ty1
type,bind(c):: a
integer :: i
type(ty1) ::ss
end type a
end program main
```
```
$ flang snfm1102_err003_3.f90
$
```
```
$ gfortran snfm1102_err003_3.f90
snfm1102_err003_3.f90:2:12:
2 | type:: ty1
| 1
Error: Derived type ‘ty1’ declared at (1) must have the BIND attribute to be C interoperable
$
```
```
$ ifx snfm1102_err003_3.f90
snfm1102_err003_3.f90(7): error #8752: This derived type component of an interoperable type is not itself interoperable (does not have the BIND(C) attribute). [SS]
type(ty1) ::ss
-----------------^
compilation aborted for snfm1102_err003_3.f90 (code 1)
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs