public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36632]  New: OpenMP code segment with module variable causes Fortran compiler to crash
@ 2008-06-25 19:24 wirawan0 at gmail dot com
  2008-06-25 19:26 ` [Bug fortran/36632] OpenMP code with access to " wirawan0 at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: wirawan0 at gmail dot com @ 2008-06-25 19:24 UTC (permalink / raw)
  To: gcc-bugs

This testcase causes GNU Fortran versions shown below (as far as I know):
  4.2.1
  4.3.0
to crash with `internal compiler error'.

This testcase shows some "features" that must exist in order to cause the
compiler to fail:

- inside the OpenMP section, it accesses a module variable (ModuleVar)

- the enclosing subroutine (named `crash' in the testcase) contains one or more
nested subroutines/functions. If NO nested subroutine is defined inside the
function, then all is OK.


Some "invariants":

- the !$omp master directive is optional; the crash occurs regardless whether
it is present.

- the access mode of ModuleVar does not matter--it can be a write or a read

- the `subroutine' keyword can be replaced with `program', and it still
crashes.


Here's the gfortran output:

$ gfortran -c -fopenmp crash.f95
crash.f95:39: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ /usr/local/gcc-4.3.0/libexec/gcc/i686-pc-linux-gnu/4.3.0/f951 -fopenmp
crash.f95
 crash blah
crash.f95: At top level:
crash.f95:39: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Here's the debugging output:

$ gdb /usr/local/gcc-4.3.0/libexec/gcc/i686-pc-linux-gnu/4.3.0/f951
GNU gdb 6.6-debian
Copyright (C) 2006 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 "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) run -fopenmp crash.f95
Starting program: /usr/local/gcc-4.3.0/libexec/gcc/i686-pc-linux-gnu/4.3.0/f951
-fopenmp crash.f95
 crash blah
Program received signal SIGSEGV, Segmentation fault.
get_frame_type (info=0x0) at ../../gcc-4.3.0/gcc/tree-nested.c:198
198       tree type = info->frame_type;
(gdb) where
#0  get_frame_type (info=0x0) at ../../gcc-4.3.0/gcc/tree-nested.c:198
#1  0x082be86f in get_chain_decl (info=0x87ab180) at
../../gcc-4.3.0/gcc/tree-nested.c:304
#2  0x082bf872 in get_nonlocal_debug_decl (info=0x87ab180, decl=0xb7caa1b8) at
../../gcc-4.3.0/gcc/tree-nested.c:904
#3  0x082c11e4 in convert_nonlocal_omp_clauses (pclauses=<value optimized out>,
wi=0xbfe1bfbc)
    at ../../gcc-4.3.0/gcc/tree-nested.c:1181
#4  0x082c0e99 in convert_nonlocal_reference (tp=0xb7ccd5fc,
walk_subtrees=0xbfe1bec8, data=0xbfe1bfbc)
    at ../../gcc-4.3.0/gcc/tree-nested.c:1099
#5  0x08382e8d in walk_tree_1 (tp=0xb7ccd5fc, func=0x82c0c80
<convert_nonlocal_reference>, data=0xbfe1bfbc, pset=0x0, lh=0)
    at ../../gcc-4.3.0/gcc/tree.c:8391
#6  0x082bfd30 in walk_stmts (wi=0xbfe1bfbc, tp=0xb7ccd5fc) at
../../gcc-4.3.0/gcc/tree-nested.c:640
#7  0x082bfefd in walk_stmts (wi=0xbfe1bfbc, tp=0xb7cab0e8) at
../../gcc-4.3.0/gcc/tree-nested.c:575
#8  0x082bfd78 in walk_stmts (wi=0xbfe1bfbc, tp=0xb7cd7d08) at
../../gcc-4.3.0/gcc/tree-nested.c:594
#9  0x082bffab in walk_body (callback=0x82c0c80 <convert_nonlocal_reference>,
info=0x0, stmt_p=0xb7caa1b8)
    at ../../gcc-4.3.0/gcc/tree-nested.c:657
#10 0x082bffed in walk_all_functions (callback=0x82c0c80
<convert_nonlocal_reference>, root=0x87ab180)
    at ../../gcc-4.3.0/gcc/tree-nested.c:665
#11 0x082c00ca in lower_nested_functions (fndecl=0xb7cd7cb0) at
../../gcc-4.3.0/gcc/tree-nested.c:2001
#12 0x083cec09 in cgraph_finalize_function (decl=0xb7cd7cb0, nested=0 '\0') at
../../gcc-4.3.0/gcc/cgraphunit.c:620
#13 0x080de9bf in gfc_generate_function_code (ns=0x87aaa38) at
../../gcc-4.3.0/gcc/fortran/trans-decl.c:3376
#14 0x0809bdad in gfc_parse_file () at ../../gcc-4.3.0/gcc/fortran/parse.c:3579
#15 0x080c71c5 in gfc_be_parse_file (set_yydebug=0) at
../../gcc-4.3.0/gcc/fortran/f95-lang.c:260
#16 0x0828ef04 in toplev_main (argc=3, argv=0xbfe1c334) at
../../gcc-4.3.0/gcc/toplev.c:1042
#17 0x0810145f in main (argc=150994976, argv=0x0) at
../../gcc-4.3.0/gcc/main.c:35

Note that I built my own GCC on an Intel Pentium M laptop with Ubuntu 7.04
Linux, and using gmp version 4.2.2 and mpfr 2.3.1 .


-- 
           Summary: OpenMP code segment with module variable causes Fortran
                    compiler to crash
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wirawan0 at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/36632] OpenMP code with access to module variable causes Fortran compiler to crash
  2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
@ 2008-06-25 19:26 ` wirawan0 at gmail dot com
  2008-06-26  5:51 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: wirawan0 at gmail dot com @ 2008-06-25 19:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from wirawan0 at gmail dot com  2008-06-25 19:25 -------
Created an attachment (id=15813)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15813&action=view)
Fortran95 source code

No postprocessing needed. To reproduce the error, use:

gfortran -c -fopenmp crash.f95


-- 


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


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

* [Bug fortran/36632] OpenMP code with access to module variable causes Fortran compiler to crash
  2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
  2008-06-25 19:26 ` [Bug fortran/36632] OpenMP code with access to " wirawan0 at gmail dot com
@ 2008-06-26  5:51 ` burnus at gcc dot gnu dot org
  2008-07-02 14:43 ` wirawan0 at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-26  5:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-06-26 05:50 -------
Fails here with 4.2 and 4.3. However, works with gfortran 4.4, which is e.g.
available from http://gcc.gnu.org/wiki/GFortranBinaries


-- 


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


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

* [Bug fortran/36632] OpenMP code with access to module variable causes Fortran compiler to crash
  2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
  2008-06-25 19:26 ` [Bug fortran/36632] OpenMP code with access to " wirawan0 at gmail dot com
  2008-06-26  5:51 ` burnus at gcc dot gnu dot org
@ 2008-07-02 14:43 ` wirawan0 at gmail dot com
  2008-07-27 16:46 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: wirawan0 at gmail dot com @ 2008-07-02 14:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from wirawan0 at gmail dot com  2008-07-02 14:43 -------
This problem also occurs with gfortran 4.3.1.


-- 


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


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

* [Bug fortran/36632] OpenMP code with access to module variable causes Fortran compiler to crash
  2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
                   ` (2 preceding siblings ...)
  2008-07-02 14:43 ` wirawan0 at gmail dot com
@ 2008-07-27 16:46 ` dfranke at gcc dot gnu dot org
  2008-12-28  0:36 ` pinskia at gcc dot gnu dot org
  2009-03-28 12:07 ` fxcoudert at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-07-27 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2008-07-27 16:45 -------
Backport becomes more unlikely as trees diverge more and more. 

Suggest submitting the testcase to avoid regression and closing as WONTFIX for
4.3.x?


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |WAITING
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |
           Keywords|                            |ice-on-valid-code, openmp
      Known to fail|                            |4.2.5 4.3.1
      Known to work|                            |4.4.0


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


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

* [Bug fortran/36632] OpenMP code with access to module variable causes Fortran compiler to crash
  2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
                   ` (3 preceding siblings ...)
  2008-07-27 16:46 ` dfranke at gcc dot gnu dot org
@ 2008-12-28  0:36 ` pinskia at gcc dot gnu dot org
  2009-03-28 12:07 ` fxcoudert at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28  0:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2008-12-28 00:34 -------
Fixed for 4.4 since there has been no feedback in 3 months.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

* [Bug fortran/36632] OpenMP code with access to module variable causes Fortran compiler to crash
  2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
                   ` (4 preceding siblings ...)
  2008-12-28  0:36 ` pinskia at gcc dot gnu dot org
@ 2009-03-28 12:07 ` fxcoudert at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-28 12:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2009-03-28 12:07 -------
*** Bug 37644 has been marked as a duplicate of this bug. ***


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rlnaff at usgs dot gov


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


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

end of thread, other threads:[~2009-03-28 12:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-25 19:24 [Bug fortran/36632] New: OpenMP code segment with module variable causes Fortran compiler to crash wirawan0 at gmail dot com
2008-06-25 19:26 ` [Bug fortran/36632] OpenMP code with access to " wirawan0 at gmail dot com
2008-06-26  5:51 ` burnus at gcc dot gnu dot org
2008-07-02 14:43 ` wirawan0 at gmail dot com
2008-07-27 16:46 ` dfranke at gcc dot gnu dot org
2008-12-28  0:36 ` pinskia at gcc dot gnu dot org
2009-03-28 12:07 ` 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).