public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/31604]  New: Segfault at runtime on I/O to preconnected unit with OpenMP
@ 2007-04-17 12:59 fxcoudert at gcc dot gnu dot org
  2007-04-17 13:03 ` [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking fxcoudert at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-17 12:59 UTC (permalink / raw)
  To: gcc-bugs

$ cat hello.f90
  integer :: tid
!$omp parallel private(tid)
  tid = 0
  if (tid .eq. 0) write(*,*) 'hello'
!$omp end parallel
end
$ gfortran -fopenmp hello.f90 -g -static         
$ ./a.out 
zsh: segmentation fault  ./a.out

It appears to be due to the combination of
   (i) spawning a thread
  (ii) writing to a preconnected unit
 (iii) having a statically linked binary
If you remove any of these three, it works fine.


-- 
           Summary: Segfault at runtime on I/O to preconnected unit with
                    OpenMP
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
@ 2007-04-17 13:03 ` fxcoudert at gcc dot gnu dot org
  2007-04-17 14:44 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-17 13:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-04-17 14:03 -------
It also fails with non-preconnected unit, if the unit is opened outside the
parallel region:

$ cat hello.f90
  integer :: tid
  open (10, file="foo")
!$omp parallel private(tid)
  tid = 0
  if (tid .eq. 0) write(10,*) 'hello'
!$omp end parallel
end
$ gfortran -fopenmp hello.f90 -g -static && ./a.out
zsh: segmentation fault  ./a.out


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-17 14:03:13
               date|                            |
            Summary|Segfault at runtime on I/O  |Segfault at runtime on I/O
                   |to preconnected unit with   |with OpenMP and static
                   |OpenMP                      |linking


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
  2007-04-17 13:03 ` [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking fxcoudert at gcc dot gnu dot org
@ 2007-04-17 14:44 ` pinskia at gcc dot gnu dot org
  2007-04-17 14:56 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-17 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-04-17 15:43 -------
>  (iii) having a statically linked binary

Can you check that the pthread functions are being resolved?
Also do you have a libc which crashes for static linked TLS?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
  2007-04-17 13:03 ` [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking fxcoudert at gcc dot gnu dot org
  2007-04-17 14:44 ` pinskia at gcc dot gnu dot org
@ 2007-04-17 14:56 ` fxcoudert at gcc dot gnu dot org
  2007-04-17 15:00 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-17 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2007-04-17 15:56 -------
(In reply to comment #2)
> Can you check that the pthread functions are being resolved?
> Also do you have a libc which crashes for static linked TLS?

How do I know the answer to those two questions? I have a glibc-2.4 from redhat
(the Fedora Core 4 one).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-04-17 14:56 ` fxcoudert at gcc dot gnu dot org
@ 2007-04-17 15:00 ` pinskia at gcc dot gnu dot org
  2007-04-17 15:05 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-17 15:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-04-17 15:59 -------
You check where the segfault is happening.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-04-17 15:00 ` pinskia at gcc dot gnu dot org
@ 2007-04-17 15:05 ` fxcoudert at gcc dot gnu dot org
  2007-04-17 15:23 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-17 15:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-04-17 16:05 -------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 140130416 (LWP 25328)]
0x00000000 in ?? ()
(gdb) where
#0  0x00000000 in ?? ()
#1  0x0804cdbb in get_external_unit (n=6, do_create=1)
    at
/home/fxcoudert/gfortran_nightbuild/trunk/libgfortran/../gcc/gthr-posix.h:613
#2  0x0804b987 in data_transfer_init (dtp=0xbfe9b024, read_flag=0)
    at /home/fxcoudert/gfortran_nightbuild/trunk/libgfortran/io/transfer.c:1702
#3  0x0804827f in MAIN__.omp_fn.0 (.omp_data_i=0x0) at hello.f90:2
#4  0x08048235 in MAIN__ () at hello.f90:2
#5  0x080482dd in main (argc=Cannot access memory at address 0x1

The line 613 in gcc/gthr-posix.h is the call to pthread_mutex_trylock() in:

static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
{
  if (__gthread_active_p ())
    return __gthrw_(pthread_mutex_trylock) (mutex);
  else
    return 0;
}


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2007-04-17 15:56:53         |2007-04-17 16:05:21
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-04-17 15:05 ` fxcoudert at gcc dot gnu dot org
@ 2007-04-17 15:23 ` pinskia at gcc dot gnu dot org
  2007-04-18 10:14 ` dfranke at gcc dot gnu dot org
  2007-04-18 17:47 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-17 15:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-04-17 16:23 -------
So pthreads is not linking in correctly.  This was a known issue I thought and
maybe in a way a non issue.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-04-17 15:23 ` pinskia at gcc dot gnu dot org
@ 2007-04-18 10:14 ` dfranke at gcc dot gnu dot org
  2007-04-18 17:47 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-04-18 10:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dfranke at gcc dot gnu dot org  2007-04-18 11:14 -------
See also: PR30471, PR30613 and PR31400 :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking
  2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-04-18 10:14 ` dfranke at gcc dot gnu dot org
@ 2007-04-18 17:47 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-18 17:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fxcoudert at gcc dot gnu dot org  2007-04-18 18:47 -------


*** This bug has been marked as a duplicate of 30471 ***


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-18 17:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-17 12:59 [Bug libfortran/31604] New: Segfault at runtime on I/O to preconnected unit with OpenMP fxcoudert at gcc dot gnu dot org
2007-04-17 13:03 ` [Bug libfortran/31604] Segfault at runtime on I/O with OpenMP and static linking fxcoudert at gcc dot gnu dot org
2007-04-17 14:44 ` pinskia at gcc dot gnu dot org
2007-04-17 14:56 ` fxcoudert at gcc dot gnu dot org
2007-04-17 15:00 ` pinskia at gcc dot gnu dot org
2007-04-17 15:05 ` fxcoudert at gcc dot gnu dot org
2007-04-17 15:23 ` pinskia at gcc dot gnu dot org
2007-04-18 10:14 ` dfranke at gcc dot gnu dot org
2007-04-18 17:47 ` fxcoudert 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).