| Issue |
76529
|
| Summary |
Cannot have Cray pointer to `bind(C)` object
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
eschnett
|
Flang reports an error when I declare a Cray pointer to a `bind(C)` type. The error complains that the `bind(C)` does not have the `sequence` attribute. I think this is wrong; `bind(C)` types implicitly have the sequence attribute (or a very similar property), and I thus think this code should be accepted.
The failing code is:
```Fortran
module m
implicit none
! Declare a type. It's a "bind(C)" type and thus cannot have the "sequence" attribute.
type, bind(C) :: t
integer i
end type t
! Define a Cray pointer that dereferences to a value of this type.
type(t) :: val
integer*8 :: ptr
pointer (ptr, val)
end module m
```
This is the error:
```
$ flang-new-mp-17 -S cray.f90
error: Semantic errors in cray.f90
./cray.f90:12:17: error: Type of Cray pointee 'val' is a non-sequence derived type
pointer (ptr, val)
^^^
```
Adding the `sequence` attribute does not work because `bind(C)` types are not allowed to have this attribute, and Flang then reports an error.
FWIW GFortran accepts this code (with the `-fcray-pointer` option).
I am using `flang-new-mp` on macOS installed via MacPorts.
```
$ flang-new-mp-17 --version
flang-new version 17.0.6
Target: x86_64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-17/bin
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs