This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/78387] New: OpenMP segfault/stack size exceeded writing to internal file


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

            Bug ID: 78387
           Summary: OpenMP segfault/stack size exceeded writing to
                    internal file
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com
  Target Milestone: ---

The following code when run using OpenMP crashes with a "stack size exceeded"
error (and, sometimes, a segfault) under gfortran 7.0.0 (r242500). This happens
most times I run the code, but not every time. When compiled with gfortran
6.0.0 it runs successfully every time.

program p
  double precision :: b
  b=0.1d0
  !$omp parallel
  call s(b)
  !$omp end parallel
contains
  subroutine s(a)
    implicit none
    double precision, intent(in) :: a
    character(len=10) :: f,c
    write (f,'(a5,i1,a1)') "(e10.",2,")"
    write (c,f) a
    write (0,*) trim(c)
    return
  end subroutine s
end program p

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 7.0.0 20161116 (experimental) (GCC) 

$ gfortran t.F90 -g -fopenmp
[abenson@mies v0.9.4]$ a.out 
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
At line 12 of file t.F90
Internal Error: stash_internal_unit(): Stack Size Exceeded

Error termination. Backtrace:
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
   0.10E+00
#0  0x400a7b in s
        at /home/abenson/Galacticus/v0.9.4/t.F90:12
#1  0x400c53 in MAIN__._omp_fn.0
        at /home/abenson/Galacticus/v0.9.4/t.F90:5
#2  0x7f786cbc955d in gomp_thread_start
        at ../../../gcc-trunk/libgomp/team.c:119
#3  0x7f786bdbdc39 in start_thread
        at
/data001/abenson/Galacticus/Tools/glibc-2.12.1/nptl/pthread_create.c:301
#4  0x7f786c4c361c in ???
        at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
#5  0xffffffffffffffff in ???

The frequency with which the code crashes increases as the number of OpenMP
threads is increased (running with 2 threads it almost always runs
successfully, with 4 threads it crashes on 1 run in 10-20, with 16 threads it
crashes almost every time).

The error is sometimes reported at line 12, sometimes at line 13 - but always
the same "stack size exceeded" error.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]