Skip to content

[Flang][OpenMP] Incorrect execution result when a variable declared by both common and namelist statement is used in do reduction construct and namelist-group-name is output #101907

@ohno-fj

Description

@ohno-fj
Version of flang-new : 19.0.0(41211919db5feb279d2954eb590a3cf2a1742152)/AArch64

When a variable declared by both common and namelist statement is used in do reduction construct and namelist-group-name is output, the output is incorrect.

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

snggq855_222.f90:

program main
  call sub1
end program main

subroutine sub1()
  common // im1
  namelist /nam/im1
  im1=10
!$omp parallel
!$omp do reduction (+:im1)
  do j=1,4
     im1 = im1 + 1
     write(1,nam)
  enddo
!$omp enddo
!$omp end parallel
end subroutine sub1
$ flang-new -fopenmp snggq855_222.f90; ./a.out; cat fort.1
 &NAM IM1= 10/
 &NAM IM1= 10/
 &NAM IM1= 10/
 &NAM IM1= 10/
$
$ gfortran -fopenmp snggq855_22.f90; ./a.out; cat fort.1
&NAM
 IM1=1          ,
 /
&NAM
 IM1=2          ,
 /
&NAM
 IM1=1          ,
 /
&NAM
 IM1=2          ,
 /
$
$ ifort -qopenmp -diag-disable=10448 snggq855_22.f90; ./a.out; cat fort.1
 &NAM
 IM1     =           1
 /
 &NAM
 IM1     =           1
 /
 &NAM
 IM1     =           2
 /
 &NAM
 IM1     =           2
 /
$

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions