Issue 169590
Summary [Flang] Module parameters not visible inside EQUIVALANCE statement
Labels flang
Assignees
Reporter edvinolo
    When using an integer parameter or a kind parameter suffix for an integer literal inside an ```EQUIVALENCE``` statement, Flang reports that the parameters are not found,  unless they are declared directly inside the procedure containing the ```EQUIVALENCE``` statement (or imported via a ```USE``` statement inside the procedure). This happens even if the parameters are declared in the module containing the procedure.

Reproducer:
https://gcc.godbolt.org/z/KW3Gq7GGn

```
module m_1
implicit none
integer, parameter :: k = kind(1)
integer, parameter :: c = 1_k

contains
subroutine test(x)
! Module compiles if the lines below are included
! integer, parameter :: k = kind(1)
! integer,parameter :: c = 1_k
integer(k), intent(inout) :: x

integer(k) :: a(5),b(5,5)

equivalence (a(1_k),b(1_k,c))

x = x + 5_k
b = 10_k
x = x + sum(b) + a(1_k)

end subroutine test

end module m_1
```

Flang output:
```
error: Semantic errors in /app/example.f90
/app/example.f90:15:18: error: Parameter 'k' not found
 equivalence (a(1_k),b(1_k,c))
                   ^
/app/example.f90:15:25: error: Parameter 'k' not found
  equivalence (a(1_k),b(1_k,c))
 ^
/app/example.f90:15:27: error: No explicit type declared for 'c'
  equivalence (a(1_k),b(1_k,c))
                            ^
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to