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