Issue 166278
Summary [Flang][OpenMP] Incorrect compilation message for complex part designator of complex variable with ALLOCATABLE attribute within ATOMIC CAPTURE construct
Labels flang:openmp
Assignees
Reporter ohno-fj
    ```
Version of flang : 22.0.0(51427079f73df85716b1c63cf3a436a128b96188)/AArch64
```

In the attached program (`sngtatcmp10_2.f90`), there exists `complex variable (cmp)` with `ALLOCATABLE attribute`.
`Complex part designator (cmp%re)` for `complex variable` within `ATOMIC CAPTURE construct` does not possess `ALLOCATABLE attribute`, yet the following erroneous compilation error message is output.
```
error: Atomic variable cmp%RE cannot be ALLOCATABLE
```
This message appears to state that `cmp%RE` possesses `ALLOCATABLE attribute`.

When I try to specify `cmp%re` as an argument to `ALLOCATED intrinsic function`, the following message is output:
```
error: Argument of ALLOCATED() must be an ALLOCATABLE object or component
```
It seems Flang recognizes `cmp%re` as not having `ALLOCATABLE attribute`.

Therefore, the error message during compilation seems incorrect.

The following are the test program, Flang, Gfortran and ifx compilation/execution results.

sngtatcmp10_2.f90:
```fortran
program main
  complex,allocatable:: cmp
  complex:: z
 allocate(cmp,source=(1,2))
  z=0
!$omp atomic capture
  z%re=cmp%re
 cmp%re=3
!$omp end atomic
  if(abs(z-(1,0))>0.1) print *,'err-2'
 if(abs(cmp-(3,2))>0.1) print *,'err-1'
  print *,'pass'
end program main
```

```
$ flang -fopenmp sngtatcmp10_2.f90
error: Semantic errors in sngtatcmp10_2.f90
./sngtatcmp10_2.f90:7:8: error: Atomic variable cmp%RE cannot be ALLOCATABLE
    z%re=cmp%re
 ^^^^^^
./sngtatcmp10_2.f90:8:3: error: Atomic variable cmp%RE cannot be ALLOCATABLE
    cmp%re=3
    ^^^^^^
$
```

```
$ export OMP_NUM_THREADS=2; gfortran -fopenmp sngtatcmp10_2.f90; ./a.out
 pass
$
```

```
$ ifx -qopenmp sngtatcmp10_2.f90
          #0 0x000000000312d792
          #1 0x0000000003191e57
          #2 0x000000000317d936
          #3 0x00000000031e990c
          #4 0x00000000031e0f14
          #5 0x00000000031e1495
          #6 0x00000000031e3ed0
          #7 0x00000000031e0f14
          #8 0x00000000031de38a
          #9 0x00000000031e0f14
         #10 0x00000000030787c6
         #11 0x0000000003078175
         #12 0x000000000324df17
         #13 0x00001538e3e66590
         #14 0x00001538e3e66640 __libc_start_main + 128
         #15 0x0000000002eb06ea

sngtatcmp10_2.f90(7): error #5623: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
  z%re=cmp%re
--^
compilation aborted for sngtatcmp10_2.f90 (code 3)
$
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to