This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Fwd: Segmentation fault in openmp simple routine from libgomp testsuite.
- From: "Benjamin Réveillé" <benjamin dot reveille at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Tue, 28 Feb 2006 17:15:26 +0100
- Subject: Fwd: Segmentation fault in openmp simple routine from libgomp testsuite.
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SpukjiefQiht06UJDpxabtPphFkbkR8z/ovYqmkAoqKNGNcTFCH93eM6hqABkaIMV/Snow9MwpUhLXeJIIbDUoZTvbWOC1H3nA2cacsqGHFk8aAk5zIZMGLTrb6WKDQQTID2eZS3dLR4OtlIWq2T3QB+tP9mBSdm29Pv5pAqVH4=
- References: <200602280858.23231.benjamin.reveille@gmail.com> <19c433eb0602280508k6c1ef204x645c1fc263fa77eb@mail.gmail.com> <9e363c0d0602280813y54cee9ebk392dc2b195fd9b7a@mail.gmail.com>
Hi FX
I hadn't tried dynamic linking... I have now and it also works fine...
Should I file a bug ?
Benjamin
On 2/28/06, François-Xavier Coudert <fxcoudert@gmail.com> wrote:
> > I might be missing out on something but I get a segmentation fault when
> > manualy executing omp_hello.f from libgomp testsuite
> > (libgomp/testsuite/libgomp.fortran/omp_hello.f)...
> >
> > Compiled using gfortran -static -fopenmp -g omp_hello.f -o omp_hello
>
> Hum... for trunk on i686-linux, I do see the following. Dynamic
> linking works fine:
>
> $ gfortran -fopenmp omp_hello.f && OMP_NUM_THREADS=2 ./a.out
> Hello World from thread = 0
> Number of threads = 2
> Hello World from thread = 1
>
> Static linking fails:
>
> $ gfortran -fopenmp omp_hello.f -static
> /tmp/cc697VvU.o(.text+0x24): In function `MAIN__':
> omp_hello.f: undefined reference to `GOMP_parallel_start'
> /tmp/cc697VvU.o(.text+0x39):omp_hello.f: undefined reference to
> `GOMP_parallel_end'
> /tmp/cc697VvU.o(.text+0x49): In function `MAIN__.omp_fn.0':
> omp_hello.f: undefined reference to `omp_get_thread_num_'
> /tmp/cc697VvU.o(.text+0xe3):omp_hello.f: undefined reference to
> `omp_get_num_threads_'
> collect2: ld returned 1 exit status
>
> The reading of the libgomp.spec lead me to give it explicitly the
> needed libraries (although it shouldn't be necessary, I guess). But
> then, it segfaults:
>
> $ gfortran -fopenmp omp_hello.f -static -lgomp -lrt && OMP_NUM_THREADS=2 ./a.out
> zsh: segmentation fault OMP_NUM_THREADS=2 ./a.out
>
> And the backtrace is:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08048466 in initialize_team () at ../../../gcc/libgomp/config/posix/sem.h:75
> 75 ../../../gcc/libgomp/config/posix/sem.h: No such file or directory.
> in ../../../gcc/libgomp/config/posix/sem.h
> (gdb) where
> #0 0x08048466 in initialize_team ()
> at ../../../gcc/libgomp/config/posix/sem.h:75
> #1 0x080aff5e in __do_global_ctors_aux ()
> #2 0x08048109 in _init ()
> #3 0x080613ed in __libc_csu_init ()
> #4 0x08061138 in __libc_start_main ()
> #5 0x08048141 in _start ()
>
>
> PS: Some details on the static linking failure:
>
> Driving: gfortran -fopenmp omp_hello.f -static -v -lgfortranbegin -lgfortran -lm
> Using built-in specs.
> Target: i386-linux
> Configured with: ../gcc/configure
> --prefix=/cosmic/coudert/tmp/gfortran-20060228/irun
> --enable-languages=c,fortran --host=i386-linux
> --with-gmp=/cosmic/coudert/tmp/gfortran-20060228/gfortran_libs
> Thread model: posix
> gcc version 4.2.0 20060228 (experimental)
> /tmpdir/opt/gfortran/gfortran-20060228/bin/../libexec/gcc/i386-linux/4.2.0/f951
> omp_hello.f -ffixed-form -quiet -dumpbase omp_hello.f -mtune=i386
> -auxbase omp_hello -version -fopenmp -I
> /tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc/i386-linux/4.2.0/finclude
> -o /tmp/ccGKM8HT.s
> GNU F95 version 4.2.0 20060228 (experimental) (i386-linux)
> compiled by GNU C version 4.2.0 20060228 (experimental).
> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> as -V -Qy -o /tmp/cc08jqIE.o /tmp/ccGKM8HT.s
> GNU assembler version 2.15.94.0.2.2 (i386-redhat-linux) using BFD
> version 2.15.94.0.2.2 20041220
> Reading specs from
> /tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc/i386-linux/4.2.0/../../../libgomp.spec
> /tmpdir/opt/gfortran/gfortran-20060228/bin/../libexec/gcc/i386-linux/4.2.0/collect2
> -m elf_i386 -static /usr/lib/crt1.o /usr/lib/crti.o
> /tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc/i386-linux/4.2.0/crtbeginT.o
> -lgomp -lrt -L/tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc/i386-linux/4.2.0
> -L/tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc
> -L/tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc/i386-linux/4.2.0/../../..
> /tmp/cc08jqIE.o -lgfortranbegin -lgfortran -lm --start-group -lgcc
> -lgcc_eh -lpthread -lc --end-group
> /tmpdir/opt/gfortran/gfortran-20060228/bin/../lib/gcc/i386-linux/4.2.0/crtend.o
> /usr/lib/crtn.o
> /tmp/cc08jqIE.o(.text+0x24): In function `MAIN__':
> omp_hello.f: undefined reference to `GOMP_parallel_start'
> /tmp/cc08jqIE.o(.text+0x39):omp_hello.f: undefined reference to
> `GOMP_parallel_end'
> /tmp/cc08jqIE.o(.text+0x49): In function `MAIN__.omp_fn.0':
> omp_hello.f: undefined reference to `omp_get_thread_num_'
> /tmp/cc08jqIE.o(.text+0xe3):omp_hello.f: undefined reference to
> `omp_get_num_threads_'
> collect2: ld returned 1 exit status
>
> --
> FX
>