[Bug fortran/77878] New: Valid OpenMP reduction of allocatable array produces a warning with -Wrealloc-lhs
ibethune at epcc dot ed.ac.uk
gcc-bugzilla@gcc.gnu.org
Thu Oct 6 05:30:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77878
Bug ID: 77878
Summary: Valid OpenMP reduction of allocatable array produces a
warning with -Wrealloc-lhs
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ibethune at epcc dot ed.ac.uk
Target Milestone: ---
An OpenMP fortran code which declares an allocatable array as an OpenMP
reduction variable generates a warning when compiled with -Wrealloc-lhs. I have
observed this with gfortran 6.1.0.
A simple example to show this:
mbp-ib:reduction ibethune$ cat reduction.f90
program reduction
double precision, dimension(:), allocatable :: a
allocate(a(3))
!$OMP PARALLEL REDUCTION(+:a)
!$OMP END PARALLEL
deallocate(a)
end program
mbp-ib:reduction ibethune$ gfortran -Wrealloc-lhs -fopenmp -o reduction
reduction.f90
reduction.f90:4:29:
!$OMP PARALLEL REDUCTION(+:a)
1
Warning: Code for reallocating the allocatable array at (1) will be added
[-Wrealloc-lhs]
mbp-ib:reduction ibethune$ gfortran -Wrealloc-lhs -o reduction reduction.f90
mbp-ib:reduction ibethune$
It's desirable to have this warning flag enabled to guard against poor code
style elswhere in the codebase e.g. array assignment without (:) notation.
Would it be possible to either:
* Have the OpenMP directives translated into code which does not trigger this
warning
or
* Have the warning silenced when it comes from OpenMP-generated code rather
than user code.
Thanks!
More information about the Gcc-bugs
mailing list