public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/59546] New: wrong behavior with reduction
@ 2013-12-18 12:37 valeryweber at hotmail dot com
2013-12-18 12:45 ` [Bug libgomp/59546] " jakub at gcc dot gnu.org
2021-06-08 14:15 ` rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: valeryweber at hotmail dot com @ 2013-12-18 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59546
Bug ID: 59546
Summary: wrong behavior with reduction
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: valeryweber at hotmail dot com
CC: jakub at gcc dot gnu.org
hi all
the following code is producing strange result (removing the writes works
fine). is it a bug?
v
gfortran-trunk --version
GNU Fortran (GCC) 4.9.0 20131119 (experimental)
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
[vwe@triest semd]$ cat gcc_reduction.f90
program test
use omp_lib
implicit none
integer :: i
!$omp parallel reduction(+:i)
i=1
!$omp master
write(*,*) 'first write'
write(*,*) 'second write'
!$omp end master
!$omp end parallel
if(i.ne.omp_get_max_threads()) then
write(*,*) i
stop 'err1'
endif
end program test
[vwe@triest semd]$ export OMP_NUM_THREADS=1; gfortran-trunk -fopenmp
gcc_reduction.f90 ; ./a.out
first write
second write
49
STOP err1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libgomp/59546] wrong behavior with reduction
2013-12-18 12:37 [Bug libgomp/59546] New: wrong behavior with reduction valeryweber at hotmail dot com
@ 2013-12-18 12:45 ` jakub at gcc dot gnu.org
2021-06-08 14:15 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-12-18 12:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59546
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
i is uninitialized before the reduction, so if you add some number of threads
to an uninitialized value, you can get pretty much anything.
Also, there is no guarantee !$omp parallel will create exactly
omp_get_max_threads () threads, that is just maximum for the number of threads,
it can depend on env vars etc.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libgomp/59546] wrong behavior with reduction
2013-12-18 12:37 [Bug libgomp/59546] New: wrong behavior with reduction valeryweber at hotmail dot com
2013-12-18 12:45 ` [Bug libgomp/59546] " jakub at gcc dot gnu.org
@ 2021-06-08 14:15 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-08 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59546
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Invalid then.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-08 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-18 12:37 [Bug libgomp/59546] New: wrong behavior with reduction valeryweber at hotmail dot com
2013-12-18 12:45 ` [Bug libgomp/59546] " jakub at gcc dot gnu.org
2021-06-08 14:15 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).