[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2014-01-17 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek jakub at gcc dot gnu.org ---
Created attachment 31867
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31867action=edit
gcc49-pr59440.patch

Untested fix.


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2014-01-17 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

--- Comment #11 from Jakub Jelinek jakub at gcc dot gnu.org ---
Author: jakub
Date: Fri Jan 17 14:42:58 2014
New Revision: 206711

URL: http://gcc.gnu.org/viewcvs?rev=206711root=gccview=rev
Log:
PR fortran/59440
* tree-nested.c (convert_nonlocal_reference_stmt,
convert_local_reference_stmt): For NAMELIST_DECLs in gimple_bind_vars
of GIMPLE_BIND stmts, adjust associated decls.

* gfortran.dg/pr59440-1.f90: New test.
* gfortran.dg/pr59440-2.f90: New test.
* gfortran.dg/pr59440-3.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pr59440-1.f90
trunk/gcc/testsuite/gfortran.dg/pr59440-2.f90
trunk/gcc/testsuite/gfortran.dg/pr59440-3.f90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-nested.c


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2014-01-17 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from Jakub Jelinek jakub at gcc dot gnu.org ---
Fixed.


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2014-01-17 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||mrestelli at gmail dot com

--- Comment #13 from Jakub Jelinek jakub at gcc dot gnu.org ---
*** Bug 59806 has been marked as a duplicate of this bug. ***


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-19 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P1


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-18 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

--- Comment #8 from Tobias Burnus burnus at gcc dot gnu.org ---
The problem is the following code in tree-nested.c:


/* A subroutine of convert_local_reference.  Create a local variable
   in the parent function with DECL_VALUE_EXPR set to reference the
   field in FRAME.  This is used both for debug info and in OpenMP
   lowering.  */

static tree
get_local_debug_decl (struct nesting_info *info, tree decl, tree field)
{
...
  new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
 VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
  DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
...
  /* Do not emit debug info twice.  */
  DECL_IGNORED_P (decl) = 1;
}


Result: new_decl gets emitted due to DECL_IGNORED_P being copied - but the
NAMELIST_DECL still points to the 'old' decl, which now has DECL_IGNORED_P() =
1.


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-18 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

--- Comment #9 from Tobias Burnus burnus at gcc dot gnu.org ---
I see two not so pretty solutions:

a) The simple way: Duplicate debug info by also emitting code for the original
DECL.


b) The hard  slow way:

In tree-nested.c, add another walk_tree(), to be run after walk_function(),
which searches for TREE_CODE() == NAMELIST_DECL.

Then, the easy part follows: Go through the VEC of the NAMELIST_DECL and
replace the original decl by the one returned by
pointer_map_contains(info-var_map, decl).


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-12 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

--- Comment #4 from Tobias Burnus burnus at gcc dot gnu.org ---
Author: burnus
Date: Thu Dec 12 19:41:11 2013
New Revision: 205939

URL: http://gcc.gnu.org/viewcvs?rev=205939root=gccview=rev
Log:
2013-12-12  Tobias Burnus  bur...@net-b.de

PR fortran/59440
* trans-decl.c (generate_namelist_decl): Ensure debug DIE
is created by setting DECL_IGNORED_P to 0.

2013-12-12  Tobias Burnus  bur...@net-b.de

PR fortran/59440
* gfortran.dg/namelist_83.f90: New.
* gfortran.dg/namelist_83_2.f90: New.


Added:
trunk/gcc/testsuite/gfortran.dg/namelist_83.f90
trunk/gcc/testsuite/gfortran.dg/namelist_83_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-12 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Tobias Burnus burnus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Tobias Burnus burnus at gcc dot gnu.org ---
FIXED!

Thanks for the report and quick feedback!


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-12 Thread anlauf at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Harald Anlauf anlauf at gmx dot de changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #6 from Harald Anlauf anlauf at gmx dot de ---
(In reply to Tobias Burnus from comment #5)
 FIXED!
 
 Thanks for the report and quick feedback!

Tobias,

here's another case where it crashes again:

% cat gfcbug127.f90
module gfcbug127
  implicit none
  type t
 integer :: grid = 0
  end type t
contains
  subroutine read_nml (nnml, s)
integer, intent(in)  :: nnml
type(t), intent(out) :: s
integer  :: grid
call read_nml_type_2
s% grid = grid
  contains
subroutine read_nml_type_2
  namelist /N/ grid
  read (nnml, nml=N)
end subroutine read_nml_type_2
  end subroutine read_nml
end module gfcbug127

% /opt/gcc/4.9/bin/gfortran -c gfcbug127.f90 -g
gfcbug127.f90: In function 'read_nml_type_2':
gfcbug127.f90:17:0: internal compiler error: in force_decl_die, at
dwarf2out.c:20111
 end subroutine read_nml_type_2
 ^
0x83eb334 force_decl_die
../../trunk/gcc/dwarf2out.c:20111
0x83eb87e gen_namelist_decl
../../trunk/gcc/dwarf2out.c:20632
0x83e9547 gen_decl_die
../../trunk/gcc/dwarf2out.c:20435
0x83fd4b5 decls_for_scope
../../trunk/gcc/dwarf2out.c:19969
0x83e31dc gen_subprogram_die
../../trunk/gcc/dwarf2out.c:18354
0x83e9b99 gen_decl_die
../../trunk/gcc/dwarf2out.c:20336
0x83eb0ce dwarf2out_function_decl
../../trunk/gcc/dwarf2out.c:20776
0x8454f92 rest_of_handle_final
../../trunk/gcc/final.c:4469
0x8454f92 execute
../../trunk/gcc/final.c:4513


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-12 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Tobias Burnus burnus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||openmp

--- Comment #7 from Tobias Burnus burnus at gcc dot gnu.org ---
Also the following variant fails, where the NAMELIST and the grid variable
are in the same subroutine - and only the NML read is in the internal
subroutine.


module gfcbug127
  implicit none
  type t
 integer :: grid = 0
  end type t
contains
  subroutine read_nml (nnml, s)
integer, intent(in)  :: nnml
type(t), intent(out) :: s
integer  :: grid
namelist /N/ grid
call read_nml_type_2
s%grid = grid
  contains
subroutine read_nml_type_2
  read (nnml, nml=N)
end subroutine read_nml_type_2
  end subroutine read_nml
end module gfcbug127


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-11 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-12-11
 CC||janus at gcc dot gnu.org
 Ever confirmed|0   |1


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-11 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

janus at gcc dot gnu.org changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu.org

--- Comment #1 from janus at gcc dot gnu.org ---
(Maybe-not-so-) Wild guess: The regression is most probably due to r205679 (cf
PR 37132).


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-11 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Tobias Burnus burnus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |burnus at gcc dot 
gnu.org

--- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org ---
Confirmed - also occurs when the namelist is in a procedure - and the problem
is independent whether it is USE associated with and without ONLY.


Lightly tested draft patch:

--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -4164,6 +4164,7 @@ generate_namelist_decl (gfc_symbol * sym)
  nml-sym-attr.referenced = 1;
  nml-sym-backend_decl = gfc_get_symbol_decl (nml-sym);
}
+  DECL_IGNORED_P (nml-sym-backend_decl) = 0;
   CONSTRUCTOR_APPEND_ELT (nml_decls, NULL_TREE, nml-sym-backend_decl);
 }


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-11 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #2)
 Lightly tested draft patch:

Fixes all occurrences of the problem for one of my larger codes (which has tons
of namelists).


[Bug fortran/59440] [4.9 Regression] ICE in force_decl_die, at dwarf2out.c:20111 with -g

2013-12-10 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59440

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|--- |4.9.0