--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: Many programs compiled with gfortran-4.4 -fopenmp segfault
- From: Stefano Simonucci <stefano.simonucci@tin.it>
- Date: Sat, 06 Mar 2010 13:09:40 +0100
- Message-id: <20100306120940.13543.39051.reportbug@localhost.localdomain>
Package: gfortran-4.4
Version: 4.4.3-3
Severity: important
Tags: l10n
I have compiled the following fortran 95 program
program test
double precision a(10000000)
a(1)=1
write(6,*) a(1)
stop
end
with the command
gfortran -fopenmp
and I get the following error message (If I try to execute the program)
stefano@debsim2:~/prova$ ./a.out
Segmentation fault
stefano@debsim2:~/prova$
-----------------------------------------------------------
If I reduce the dimension of the a array, for example
program test1
double precision a(1000000)
a(1)=1
write(6,*) a(1)
stop
end
and I compile the program with the same flag -fopenmp
the binary program can be execute
stefano@debsim2:~/prova$ ./a.out
1.0000000000000000
stefano@debsim2:~/prova$
----------------------------------------------------
If I use a dynamical allocation (the dimension of a is like the dimension in test)
program test2
double precision,allocatable :: a(:)
allocate(a(100000000))
a(1)=1
write(6,*) a(1)
stop
end
the program can be compiled (with -fopenmp) and executed.
----------------------------------------------------------
I have not used the OMP directives in these programs but I observe the same behaviour
with OMP commands.
The program
program test_omp
double precision a(10000000)
!$OMP PARALLEL DEFAULT(PRIVATE)
a(1)=1
write(6,*) a(1)
!$OMP END PARALLEL
stop
end
segfaults when compiled with the option -fopenmp
while the program
program test_omp1
double precision a(100000)
!$OMP PARALLEL DEFAULT(PRIVATE)
a(1)=1
write(6,*) a(1)
!$OMP END PARALLEL
stop
end
gives the result
stefano@debsim2:~/prova$ ./a.out
1.0000000000000000
1.0000000000000000
stefano@debsim2:~/prova$
-------------------------------------------
Analogously the program
program test_omp2
double precision,allocatable :: a(:)
!$OMP PARALLEL DEFAULT(PRIVATE)
allocate(a(100000000))
a(1)=1
write(6,*) a(1)
!$OMP END PARALLEL
stop
end
runs correctly:
stefano@debsim2:~/prova$ ./a.out
1.0000000000000000
1.0000000000000000
stefano@debsim2:~/prova$
Thank you
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-rc8-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash
Versions of packages gfortran-4.4 depends on:
ii gcc-4.4 4.4.3-3 The GNU C compiler
ii gcc-4.4-base 4.4.3-3 The GNU Compiler Collection (base
ii libc6 2.9-23 GNU C Library: Shared libraries
ii libc6-dev 2.9-23 GNU C Library: Development Librari
ii libgfortran3 4.4.3-3 Runtime library for GNU Fortran ap
ii libgmp3c2 2:4.3.2+dfsg-1 Multiprecision arithmetic library
ii libmpfr1ldbl 2.4.2-3 multiple precision floating-point
gfortran-4.4 recommends no packages.
Versions of packages gfortran-4.4 suggests:
pn gfortran-4.4-doc <none> (no description available)
pn gfortran-4.4-multilib <none> (no description available)
pn libgfortran3-dbg <none> (no description available)
-- no debconf information
--- End Message ---
--- Begin Message ---
- To: 572756-done@bugs.debian.org
- Subject: Re: Many programs compiled with gfortran-4.4 -fopenmp segfault
- From: Falk Hueffner <falk@debian.org>
- Date: Tue, 9 Mar 2010 14:02:43 +0100
- Message-id: <20100309130243.GA14740@minet.uni-jena.de>
- In-reply-to: <20100306120940.13543.39051.reportbug@localhost.localdomain>
- References: <20100306120940.13543.39051.reportbug@localhost.localdomain>
On Sat, Mar 06, 2010 at 01:09:40PM +0100, Stefano Simonucci wrote:
> I have compiled the following fortran 95 program
>
> program test
> double precision a(10000000)
> a(1)=1
> write(6,*) a(1)
> stop
> end
>
> with the command
>
> gfortran -fopenmp
> and I get the following error message (If I try to execute the program)
>
> stefano@debsim2:~/prova$ ./a.out
> Segmentation fault
When using OpenMP, the array cannot be allocated statically, but needs
to reside on the stack, and you run into the stack size limit. See
http://gcc.gnu.org/PR43050
You can use "ulimit -s unlimited" to work around this.
Falk
--- End Message ---