public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/39176] New: [4.4 Regression] -static and -fopenmp and io causes segfault
@ 2009-02-13 11:40 jv244 at cam dot ac dot uk
2009-02-13 14:01 ` [Bug libgomp/39176] " jv244 at cam dot ac dot uk
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-02-13 11:40 UTC (permalink / raw)
To: gcc-bugs
I noticed this running mixed mpi/openmp on a system that required an executable
without dynamics libraries. Don't know if the Fortran IO is supposed to be
thread safe (i.e. serialized thread safe), but this seems to work without
-static. It also appears to work with 4.3.1 but not 4.4 (trunk)
> cat test.f90
!$OMP PARALLEL
!$OMP CRITICAL
write(6,*) "Hello world"
!$OMP END CRITICAL
!$OMP END PARALLEL
write(6,*) "Done!"
END
> gfortran -static -fopenmp test.f90
> ./a.out
Segmentation fault
> gdb ./a.out
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-suse-linux"...Using host libthread_db
library "/lib64/libthread_db.so.1".
(gdb) run
Starting program: /data/vondele/omptest/a.out
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x000000000040642f in get_external_unit (n=6, do_create=1)
at /data/vondele/gcc_trunk/gcc/libgfortran/../gcc/gthr-posix.h:704
#2 0x0000000000404c01 in data_transfer_init (dtp=0x7fff047208c0, read_flag=0)
at /data/vondele/gcc_trunk/gcc/libgfortran/io/transfer.c:1828
#3 0x00000000004003d6 in MAIN__.omp_fn.0 ()
#4 0x000000000040032c in MAIN__ ()
#5 0x000000000040042c in main (argc=1, argv=0x7fff04720fa8)
at /data/vondele/gcc_trunk/gcc/libgfortran/fmain.c:21
(gdb)
--
Summary: [4.4 Regression] -static and -fopenmp and io causes
segfault
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jv244 at cam dot ac dot uk
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libgomp/39176] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] " jv244 at cam dot ac dot uk
@ 2009-02-13 14:01 ` jv244 at cam dot ac dot uk
2009-02-13 20:18 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-02-13 14:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jv244 at cam dot ac dot uk 2009-02-13 14:01 -------
(In reply to comment #4)
> It is glibc specific, on the other hand it isn't particularly -fopenmp related.
> I guess easiest will be if glibc stops shipping libpthread.a.
but if -fopenmp automatically adds -lpthread maybe it should do it in the
'proper' way if -static is also on the command line (eventually bailing out if
libpthread.a can not be found)?
Note, e.g. a warning is produced for similar issues already, e.g. I see:
/home/u1/vondele/gcc_trunk/build/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../lib64/libgfortran.a(getlog.o):
In function `_gfortran_getlog':
/home/u1/vondele/gcc_trunk/gcc/libgfortran/intrinsics/getlog.c:82: warning:
Using 'getpwuid' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
let me reopen the bug, removing the regression marker, and as an enhancement. I
think that a warning, or adding -lpthread in the 'proper' way if -static will
save many other users from loosing time on this one.
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|RESOLVED |UNCONFIRMED
Component|libfortran |libgomp
Resolution|INVALID |
Summary|[4.4 Regression] -static and|-static and -fopenmp and io
|-fopenmp and io causes |causes segfault
|segfault |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libgomp/39176] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] " jv244 at cam dot ac dot uk
2009-02-13 14:01 ` [Bug libgomp/39176] " jv244 at cam dot ac dot uk
@ 2009-02-13 20:18 ` pinskia at gcc dot gnu dot org
2009-02-13 21:00 ` jv244 at cam dot ac dot uk
2009-02-13 21:10 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-13 20:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2009-02-13 20:18 -------
Not a gcc bug so closing as invalid. That warning comes from glibc anyways.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libgomp/39176] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] " jv244 at cam dot ac dot uk
2009-02-13 14:01 ` [Bug libgomp/39176] " jv244 at cam dot ac dot uk
2009-02-13 20:18 ` pinskia at gcc dot gnu dot org
@ 2009-02-13 21:00 ` jv244 at cam dot ac dot uk
2009-02-13 21:10 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 9+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-02-13 21:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jv244 at cam dot ac dot uk 2009-02-13 21:00 -------
(In reply to comment #6)
> Not a gcc bug so closing as invalid.
The gcc 'bug' is that -fopenmp -static should link to pthreads as
-Wl,--whole-archive -lpthread -Wl,--no-whole-archive, if that is required, or
error out if that is not possible.
The current way of just adding -lpthread and hoping it is correct (even in the
presence of -static) is leading to wrong code.
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libgomp/39176] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] " jv244 at cam dot ac dot uk
` (2 preceding siblings ...)
2009-02-13 21:00 ` jv244 at cam dot ac dot uk
@ 2009-02-13 21:10 ` jakub at gcc dot gnu dot org
3 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-13 21:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jakub at gcc dot gnu dot org 2009-02-13 21:10 -------
This is not a gcc bug, glibc either should not ship libpthread.a at all or
mv libpthread.a libpthreadx.a; gcc -r -nostdlib -o libpthread.a --whole-archive
libpthreadx.a; rm libpthreadx.a
I'll try the latter in Fedora soon.
In any case, users really shouldn't use -static except for a few system
recovery tools, see
http://people.redhat.com/drepper/no_static_linking.html
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-08 20:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-39176-4@http.gcc.gnu.org/bugzilla/>
2024-04-08 20:07 ` [Bug libgomp/39176] -static and -fopenmp and io causes segfault pinskia at gcc dot gnu.org
2024-04-08 20:08 ` hjl.tools at gmail dot com
2024-04-08 20:14 ` hjl.tools at gmail dot com
2024-04-08 20:16 ` pinskia at gcc dot gnu.org
2024-04-08 20:17 ` pinskia at gcc dot gnu.org
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] " jv244 at cam dot ac dot uk
2009-02-13 14:01 ` [Bug libgomp/39176] " jv244 at cam dot ac dot uk
2009-02-13 20:18 ` pinskia at gcc dot gnu dot org
2009-02-13 21:00 ` jv244 at cam dot ac dot uk
2009-02-13 21:10 ` jakub at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).