Issue |
97241
|
Summary |
[Flang][OpenMP] Compilation error when initializer-clause is specified as declare reduction directive
|
Labels |
openmp,
flang
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang-new : 19.0.0(1f98ac095e35f12a85d71101269df00279faa55c)/AArch64
```
When `initializer-clause` is specified as `declare reduction` directive, a compilation error occurs.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
simd9_UDR_0005_22.f90:
```fortran
subroutine initn(x,n)
integer x,n
x=n
end subroutine initn
function foo0(x, n, init)
integer foo0
integer x(n)
integer tmp
tmp=init
do i=1,n
tmp=tmp+x(i)
enddo
foo0=tmp
end function foo0
function foo(x, n, init)
integer foo
integer x(n)
integer tmp
interface
subroutine initn(x,n)
integer x,n
end subroutine initn
end interface
!$omp declare reduction(udr_add:integer(4):omp_out=omp_out+omp_in) initializer(initn(omp_priv,0))
tmp=init
!$omp simd reduction(udr_add:tmp)
do i=1,n
tmp=tmp+x(i)
enddo
foo=tmp
end function foo
program main
integer,parameter::N=10
integer x(N)/1,2,3,4,5,6,7,8,9,10/
integer ret0,ret
interface
function foo0(x,n,init)
integer foo0,x(n),init
end function foo0
function foo(x,n,init)
integer foo,x(n),init
end function foo
end interface
ret0 = foo0(x,N,10)
ret = foo(x,N,10);
if (ret0.ne.ret) then
print*,"NG:",ret0,ret
endif
print*,ret0,ret
print*,"OK"
end program main
```
```
$ flang-new -fopenmp simd9_UDR_0005_2.f90
error: Could not parse simd9_UDR_0005_22.f90
./simd9_UDR_0005_22.f90:26:68: error: expected end of line
!$omp declare reduction(udr_add:integer(4):omp_out=omp_out+omp_in) initializer(initn(omp_priv,0))
^
./simd9_UDR_0005_22.f90:26:1: in the context: specification construct
!$omp declare reduction(udr_add:integer(4):omp_out=omp_out+omp_in) initializer(initn(omp_priv,0))
^
./simd9_UDR_0005_22.f90:26:1: in the context: declaration construct
!$omp declare reduction(udr_add:integer(4):omp_out=omp_out+omp_in) initializer(initn(omp_priv,0))
^
./simd9_UDR_0005_22.f90:18:3: in the context: specification part
integer foo
^
./simd9_UDR_0005_22.f90:17:1: in the context: FUNCTION subprogram
function foo(x, n, init)
^
$
```
```
$ gfortran -fopenmp simd9_UDR_0005_22.f90; ./a.out
65 65
OK
$
```
```
$ ifort -qopenmp -diag-disable=10448 simd9_UDR_0005_22.f90; ./a.out
65 65
OK
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs