Issue 89558
Summary [Flang] Compilation error when bind statement is specified at the beginning of specification-part in module
Labels flang:frontend
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 19.0.0(4f19f15a601a5761b12c9c66d99d97dbc89ef90d)/AArch64
```

When `bind` statement is specified at the beginning of `specification-part` in `module`, a compilation error occurs.

However, when `bind` statement is specified at the end of `specification-part` in `module`, a compilation terminates normally.  
The above program (snggq538_22.f90) is attached at the end.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

snggq538_2.f90:
```fortran
module m3
  bind (c,name='y3'):: x3
  integer:: x3
  common /x3/ k
contains
 subroutine z3
    k=1
    x3=2
  end subroutine z3
end module m3

subroutine s1
  use m3
  call z3
end subroutine s1

program main
  call s1
  print *,'pass'
end program main
```

```
$ flang-new snggq538_2.f90
error: Semantic errors in snggq538_2.f90
./snggq538_2.f90:2:24: error: The entity 'x3' has multiple BIND names
    bind (c,name='y3'):: x3
 ^^
./snggq538_2.f90:4:11: error: Two entities have the same global name 'x3'
    common /x3/ k
            ^^
./snggq538_2.f90:3:13: Conflicting declaration
    integer:: x3
 ^^
$
```

```
$ gfortran snggq538_2.f90; ./a.out
 pass
$
```

```
$ ifort -diag-disable=10448 snggq538_2.f90; ./a.out
 pass
$
```

snggq538_22.f90:
```fortran
module m3
  integer:: x3
  common /x3/ k
  bind (c,name='y3'):: x3
contains
  subroutine z3
    k=1
    x3=2
  end subroutine z3
end module m3

subroutine s1
  use m3
  call z3
end subroutine s1

program main
  call s1
  print *,'pass'
end program main
```

```
$ flang-new snggq538_22.f90
$
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to