llvm / llvm/llvm-project

[Flang][Semantics] Pure internal procedure incorrectly allows modification of host-associated dummy argument from parent procedure.

Open
#196,876 2 comments 0 reactions 0 assignees View on GitHub
flang
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

In the following case, the modification of _i_ inside the pure function should be rejected by flang, but currently passes semantic checks:

```
subroutine test_bad(i, x)
integer, pointer :: i
real :: x
x = func()
contains
real pure function func()
i = 0
func = 0.
end function
end subroutine

```

Flang compiler : https://godbolt.org/z/EqPax9fha
Gfortran: https://godbolt.org/z/dK4YE83E1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.