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

             Bug #: 50429
           Summary: LibGOMP built with "-flto" will result in crash code
                    for OpenMP program...
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: xunxun1...@gmail.com
              Host: *-*-mingw32
            Target: *-*-mingw32
             Build: *-*-mingw32


Created attachment 25301
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25301
OpenMP test program

If I use "-flto" to build libgomp, and build one OpenMP program with this lib
using "-flto -fuse-linker-plugin", then the program running will crash.

If I use "-flto" to build OpenMP program, then will be no problem, so this may
be libgomp's lto compile issue. 

The issue locate the problem of parallel.c.

gdb log:

GNU gdb (pcx32) 7.3.50.20110709
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from e:\t\temp\a.exe...done.
(gdb) run
Starting program: e:\t\temp\a.exe 
[New Thread 6032.0x1468]

Program received signal SIGSEGV, Segmentation fault.
gomp_icv (write=false) at e:\new\gcc\gcc4.6\build\libgomp\libgomp.h:380
380      struct gomp_task *task = gomp_thread ()->task;
(gdb) bt
#0  gomp_icv (write=false) at e:\new\gcc\gcc4.6\build\libgomp\libgomp.h:380
#1  gomp_resolve_num_threads (specified=2, count=0)
    at e:\new\gcc\gcc4.6\build\libgomp\parallel.c:45
#2  0x00403088 in GOMP_parallel_start (fn=0x402950 <main.$loopfn.0>, 
    data=0x28fe98, num_threads=2)
    at e:\new\gcc\gcc4.6\build\libgomp\parallel.c:107
#3  0x0040c18c in main () at e:\t\temp\main.c:29
(gdb) step

Program received signal SIGSEGV, Segmentation fault.
gomp_icv (write=false) at e:\new\gcc\gcc4.6\build\libgomp\libgomp.h:380
380      struct gomp_task *task = gomp_thread ()->task;
(gdb) bt
#0  gomp_icv (write=false) at e:\new\gcc\gcc4.6\build\libgomp\libgomp.h:380
#1  gomp_resolve_num_threads (specified=2, count=0)
    at e:\new\gcc\gcc4.6\build\libgomp\parallel.c:45
#2  0x00403088 in GOMP_parallel_start (fn=0x402950 <main.$loopfn.0>, 
    data=0x28fe98, num_threads=2)
    at e:\new\gcc\gcc4.6\build\libgomp\parallel.c:107
#3  0x0040c18c in main () at e:\t\temp\main.c:29
(gdb) step
[Inferior 1 (process 6032) exited with code 030000000005]


Any ideas?
Thanks.

Reply via email to