https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu.org

--- Comment #19 from Janne Blomqvist <jb at gcc dot gnu.org> ---
As was mentioned recently on comp.lang.fortran, this affects OpenMP. Consider

program teste_paralelo
  use omp_lib
  real :: v1(12,60,60,60,2)
  !$omp parallel do
  do kk=2,60
     v1(5,2,2,kk,1)=0
  enddo
  !$omp end parallel do
  !$omp parallel
  print *, 'Hello World!'
  !$omp end parallel
end program teste_paralelo

Compiling without OpenMP and checking the binary with size, the array v1 is
allocated statically in the bss section:

$ gfortran -g teste_paralelo.f90 -o test-serial
$ size test-serial 
   text    data     bss     dec     hex filename
   2147     608 20736032        20738787        13c72e3 test-serial

Enabling openmp, the array suddenly goes on the stack:

$ gfortran -g -fopenmp teste_paralelo.f90 -o test
$ size test
   text    data     bss     dec     hex filename
   2822     656       8    3486     d9e test


If one manually makes v1 saved, it naturally goes into the bss with openmp too:

$ gfortran -g -fopenmp teste_paralelo.f90 -o test-save 
$ size test-save 
   text    data     bss     dec     hex filename
   2790     656 20736032        20739478        13c7596 test-save

Reply via email to