Skip to content

[Flang][OpenMP] Compilation error when capture-statement described in atomic capture construct contains a different type #94177

Closed
@ohno-fj

Description

@ohno-fj
Version of flang-new : 19.0.0(8930ba98e01bc66949e482b396f8389d64388359)AArch64

When capture-statement described in atomic capture construct contains a different type, the compilation terminates abnormally.

Although the results of this compilation and #93441 are different, they seem to contain similar issues.

Compilation ends normally in the following cases:

  • Do not specify the compilation option (-fopenmp)

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

OMP_3_O_007_4_atm_type_049_fo_222.f90:

subroutine sub2()
  real(kind=4)    ::  s_x_r2
  real(kind=16)   ::  s_v_r16
  complex(kind=4) ::  s_expr_c2
  s_x_r2 =10.0
  s_v_r16 = 10.0
  s_expr_c2 =(10.0,0.0)
!$omp atomic capture
  s_v_r16 = s_x_r2
  s_x_r2  = s_x_r2 + s_expr_c2
!$omp end atomic
  write(6,*) "s_v_r16 = ", s_v_r16, " s_x_r2 = " , s_x_r2
end subroutine sub2

program main
  call sub2()
end program main
$ flang-new -fopenmp OMP_3_O_007_4_atm_type_049_fo_222.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/fomp_omp40_EXA/OMP_3_O_007_4_atm_type_049_fo_222.f90":7:3): the type of the operand must be a pointer type whose element type is the same as that of the region argument
error: verification of lowering to FIR failed
$
$ gfortran -fopenmp OMP_3_O_007_4_atm_type_049_fo_222.f90
 s_v_r16 =    10.0000000000000000000000000000000000        s_x_r2 =    20.0000000
$
$ ifort -qopenmp -diag-disable=10448 OMP_3_O_007_4_atm_type_049_fo_222.f90
 s_v_r16 =    10.0000000000000000000000000000000        s_x_r2 =    20.00000
$

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions