https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72781
Bug ID: 72781
Summary: -Wuninitialized false positives in OpenMP code
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Keywords: openmp
Severity: minor
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: tschwinge at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Perhaps similar to PR70550, I found another case of -Wuninitialized false
positives in OpenMP code (at least given my limited understanding of the OpenMP
clauses involved here): for example, when compiling
libgomp/testsuite/libgomp.fortran/simd3.f90 you'll see:
[...]/libgomp.fortran/simd3.f90:58:0: Warning: 'v' may be used
uninitialized in this function [-Wmaybe-uninitialized]
[...]/libgomp.fortran/simd3.f90:54:0: note: 'v' was declared here
[...]/libgomp.fortran/simd3.f90:58:0: Warning: 'u' may be used
uninitialized in this function [-Wmaybe-uninitialized]
[...]/libgomp.fortran/simd3.f90:54:0: note: 'u' was declared here
[...]
54 integer :: p(1024), u, v, i, s, foo
55 s = 0
56 !$omp parallel
57 !$omp do simd linear(k : m + 1) reduction(+: s) lastprivate(u, v) &
58 !$omp & schedule (static, 32)
59 do i = 1, 1024
60 a(i) = a(i) * p(i)
61 u = p(i) + k
62 k = k + m + 1
63 v = p(i) + k
64 s = s + p(i) + k
65 end do
66 !$omp end do simd
67 !$omp end parallel
(Let me again raise my suggestion to actually run the libgomp testsuite with
-Wall...)
In the "gimple" dump I see "shared" clauses be added on the "omp parallel"
construct for variables referenced inside it -- I guess that's where the
warning originates? This will be easier to resolve for someone who has a
better understanding of these OpenMP clauses.