* [Bug libfortran/39176] [4.4 Regression] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
@ 2009-02-13 11:42 ` jv244 at cam dot ac dot uk
2009-02-13 11:49 ` jv244 at cam dot ac dot uk
` (7 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-02-13 11:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jv244 at cam dot ac dot uk 2009-02-13 11:42 -------
adding Jakub
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at redhat dot com
Known to fail| |4.4.0
Known to work| |4.3.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libfortran/39176] [4.4 Regression] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
2009-02-13 11:42 ` [Bug libfortran/39176] " jv244 at cam dot ac dot uk
@ 2009-02-13 11:49 ` jv244 at cam dot ac dot uk
2009-02-13 11:51 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-02-13 11:49 UTC (permalink / raw)
To: gcc-bugs
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libfortran/39176] [4.4 Regression] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
2009-02-13 11:42 ` [Bug libfortran/39176] " jv244 at cam dot ac dot uk
2009-02-13 11:49 ` jv244 at cam dot ac dot uk
@ 2009-02-13 11:51 ` jakub at gcc dot gnu dot org
2009-02-13 12:20 ` jv244 at cam dot ac dot uk
` (5 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-13 11:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2009-02-13 11:50 -------
This has been repeated many times. Don't use -static for threaded programs, it
is really bad idea, and if you really have to, you need to link the whole
libpthread.a in (-Wl,--whole-archive -lpthread -Wl,--no-whole-archive),
otherwise if it works, it is by pure luck.
This certainly isn't a regression.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Target Milestone|4.4.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libfortran/39176] [4.4 Regression] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
` (2 preceding siblings ...)
2009-02-13 11:51 ` jakub at gcc dot gnu dot org
@ 2009-02-13 12:20 ` jv244 at cam dot ac dot uk
2009-02-13 12:35 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-02-13 12:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jv244 at cam dot ac dot uk 2009-02-13 12:19 -------
(In reply to comment #2)
> This has been repeated many times. Don't use -static for threaded programs, it
> is really bad idea, and if you really have to, you need to link the whole
> libpthread.a in (-Wl,--whole-archive -lpthread -Wl,--no-whole-archive),
> otherwise if it works, it is by pure luck.
> This certainly isn't a regression.
>
Thanks for your reply, this was unknown to me, and I think for many occassional
omp users. Do you think this could be documented near the -fopenmp flag (I can
write something if you wish). Or could one have gcc warn if both -fopenmp and
-static are present ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug libfortran/39176] [4.4 Regression] -static and -fopenmp and io causes segfault
2009-02-13 11:40 [Bug libfortran/39176] New: [4.4 Regression] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
` (3 preceding siblings ...)
2009-02-13 12:20 ` jv244 at cam dot ac dot uk
@ 2009-02-13 12:35 ` jakub at gcc dot gnu dot org
2009-02-13 14:01 ` [Bug libgomp/39176] " jv244 at cam dot ac dot uk
` (3 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-13 12:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2009-02-13 12:35 -------
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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176
^ permalink raw reply [flat|nested] 15+ 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] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
` (4 preceding siblings ...)
2009-02-13 12:35 ` jakub at gcc dot gnu dot org
@ 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)
8 siblings, 0 replies; 15+ 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] 15+ 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] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
` (5 preceding siblings ...)
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
8 siblings, 0 replies; 15+ 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] 15+ 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] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
` (6 preceding siblings ...)
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
8 siblings, 0 replies; 15+ 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] 15+ 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] -static and -fopenmp and io causes segfault jv244 at cam dot ac dot uk
` (7 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
8 siblings, 0 replies; 15+ 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] 15+ messages in thread