User account creation filtered due to spam.

Bug 48207 - ICE in lhd_set_decl_assembler_name, at langhooks.c:158
Summary: ICE in lhd_set_decl_assembler_name, at langhooks.c:158
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Richard Biener
URL:
Keywords: lto
: 48346 48505 49041 49056 49424 (view as bug list)
Depends on: 48703
Blocks: mozillametabug 47819
  Show dependency treegraph
 
Reported: 2011-03-19 20:04 UTC by Dmitry Gorbachev
Modified: 2011-06-15 14:48 UTC (History)
10 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.6.1, 4.7.0
Known to fail: 4.6.0
Last reconfirmed: 2011-03-21 13:12:20


Attachments
Testcase (compile with `g++ -flto -g pr48207.cc') (74 bytes, text/plain)
2011-03-19 20:04 UTC, Dmitry Gorbachev
Details
Backtrace (980 bytes, text/plain)
2011-03-19 20:05 UTC, Dmitry Gorbachev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Gorbachev 2011-03-19 20:04:50 UTC
Created attachment 23727 [details]
Testcase (compile with `g++ -flto -g pr48207.cc')
Comment 1 Dmitry Gorbachev 2011-03-19 20:05:44 UTC
Created attachment 23728 [details]
Backtrace
Comment 2 Richard Biener 2011-03-21 13:12:20 UTC
Confirmed, mine.

We are processing BLOCKs of the function which has the TYPE_DECL.

#10 0x000000000093b5a4 in decls_for_scope (stmt=0x7ffff5b7edc0, 
    context_die=0x7ffff7ef8140, depth=1)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:20886
20886       process_scope_var (stmt, decl, NULL_TREE, context_die);
(gdb) p decl->base.code
$5 = TYPE_DECL

and we probably expect that a DIE was already created for it by
the FE:

  else if (TREE_CODE (decl_or_origin) == TYPE_DECL
           && TYPE_DECL_IS_STUB (decl_or_origin))
    die = lookup_type_die (TREE_TYPE (decl_or_origin));

...

  if (die != NULL && die->die_parent == NULL)
    add_child_die (context_die, die);

but we fall through to gen_decl_die.  Then we run into

              /* This is a GNU Extension.  We are adding a
                 DW_AT_linkage_name attribute to the DIE of the
                 anonymous struct TYPE.  The value of that attribute
                 is the name of the typedef decl naming the anonymous
                 struct.  This greatly eases the work of consumers of
                 this debug info.  */
              add_linkage_attr (lookup_type_die (type), decl);

which we barf on as we didn't create assembler-names for TYPE_DECLs
and we can't at this point (the FE isn't anymore).

Btw, LTO should override decl_assembler_name with a gcc_unreachable ().
Comment 3 Richard Biener 2011-03-30 09:02:23 UTC
*** Bug 48346 has been marked as a duplicate of this bug. ***
Comment 4 Bastiaan Jacques 2011-03-31 01:35:01 UTC
Alternative testcase (g++ -flto -g):

namespace {
  typedef struct {
    int x;
  } Foo;
}
Comment 5 Jan Hubicka 2011-04-07 21:56:25 UTC
*** Bug 48505 has been marked as a duplicate of this bug. ***
Comment 6 Richard Biener 2011-04-19 13:05:01 UTC
Author: rguenth
Date: Tue Apr 19 13:04:57 2011
New Revision: 172708

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172708
Log:
2011-04-19  Richard Guenther  <rguenther@suse.de>

	PR lto/48207
	* tree.c (free_lang_data): Do not reset the decl-assembler-name
	langhook.

	* g++.dg/lto/pr48207_0.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/lto/pr48207_0.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree.c
Comment 7 Richard Biener 2011-04-19 13:05:16 UTC
Fixed for trunk sofar.
Comment 8 Richard Biener 2011-05-18 11:08:35 UTC
*** Bug 49041 has been marked as a duplicate of this bug. ***
Comment 9 Richard Biener 2011-05-18 13:29:27 UTC
Author: rguenth
Date: Wed May 18 13:29:24 2011
New Revision: 173860

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173860
Log:
2011-05-18  Richard Guenther  <rguenther@suse.de>

        Backport from mainline
        2011-04-19  Richard Guenther  <rguenther@suse.de>

	PR lto/48207
	* tree.c (free_lang_data): Do not reset the decl-assembler-name
	langhook.

	* g++.dg/lto/pr48207_0.C: New testcase.

        2011-04-21  Richard Guenther  <rguenther@suse.de>

	PR lto/48703
	* tree.c (free_lang_data_in_decl): Do not zero TREE_TYPE of
	DECL_NAME.

	* g++.dg/lto/pr48207-2_0.C: New testcase.
	* g++.dg/lto/pr48207-3_0.C: Likewise.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/lto/pr48207-2_0.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/lto/pr48207-3_0.C
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/lto/pr48207_0.C
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree.c
Comment 10 Richard Biener 2011-05-18 13:30:00 UTC
Fixed for 4.6.1.
Comment 11 Jakub Jelinek 2011-05-19 09:51:42 UTC
*** Bug 49056 has been marked as a duplicate of this bug. ***
Comment 12 Richard Biener 2011-06-15 14:48:04 UTC
*** Bug 49424 has been marked as a duplicate of this bug. ***