aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-02-24 09:53:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-02-24 09:53:26 +0000
commit5b1cce91e5295d3c1d42e2bea4b2c6f51a4ccd65 (patch)
tree4c970e4ebdf5239ec11759f84f7472469b258a8f /gcc/fortran/f95-lang.c
parent68f792d0d5c6865aba270fd840700782576baafd (diff)
downloadgcc-5b1cce91e5295d3c1d42e2bea4b2c6f51a4ccd65.zip
gcc-5b1cce91e5295d3c1d42e2bea4b2c6f51a4ccd65.tar.gz
gcc-5b1cce91e5295d3c1d42e2bea4b2c6f51a4ccd65.tar.bz2
re PR fortran/47839 (ICE in dwarf2out.c:add_AT_specification)
2011-02-24 Richard Guenther <rguenther@suse.de> PR fortran/47839 * f95-lang.c (pushdecl): For externs in non-global scope push a copy of the decl into the BLOCK. * gfortran.dg/lto/pr47839_0.f90: New testcase. * gfortran.dg/lto/pr47839_1.f90: Likewise. From-SVN: r170463
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r--gcc/fortran/f95-lang.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index a3ac860..3340dc4 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -498,13 +498,20 @@ poplevel (int keep, int reverse, int functionbody)
tree
pushdecl (tree decl)
{
- /* External objects aren't nested, other objects may be. */
- if (DECL_EXTERNAL (decl))
- DECL_CONTEXT (decl) = NULL_TREE;
- else if (global_bindings_p ())
+ if (global_bindings_p ())
DECL_CONTEXT (decl) = current_translation_unit;
else
- DECL_CONTEXT (decl) = current_function_decl;
+ {
+ /* External objects aren't nested. For debug info insert a copy
+ of the decl into the binding level. */
+ if (DECL_EXTERNAL (decl))
+ {
+ tree orig = decl;
+ decl = copy_node (decl);
+ DECL_CONTEXT (orig) = NULL_TREE;
+ }
+ DECL_CONTEXT (decl) = current_function_decl;
+ }
/* Put the declaration on the list. The list of declarations is in reverse
order. The list will be reversed later if necessary. This needs to be