| Issue |
240410
|
| Summary |
[flang] Lowering failed on a pointer function result that also has the VOLATILE attribute
|
| Labels |
flang:fir-hlfir
|
| Assignees |
DanielCChen
|
| Reporter |
DanielCChen
|
Consider the following code:
```
program ex3203
implicit none
integer, pointer :: p
interface
function func() result(res)
integer, pointer :: res
volatile :: res
end function
end interface
p => func()
print *, p
end program
function func() result(res)
integer, pointer :: res
volatile :: res
allocate(res)
res = 7
end function
```
Flang failed at
```
error: loc("a1.f":19:1): type of return operand 0 ('!fir.box<!fir.ptr<i32>, volatile>') doesn't match function result type ('!fir.box<!fir.ptr<i32>>') in function @_QPfunc
error: verification of lowering to FIR failed
```
All gfortran, ifx and XLF compile and run it successfully.
The standard only disallows `VOLATILE` attribute on variables that are also `INTENT(IN)`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs