This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][LTO] Fix PR48207, ICE in lhd_set_decl_assembler_name


This avoids ICEing in the default decl-assembler-name hook during
compile-time.  We are not yet prepared for a world where all important
mangling is done before/during free-lang-data, and the default
langhook implementation surely isn't the one that would assert so.

The following patch simply retains the language specific hook for now
which avoids the ICE.  At link time we use the LTO implementation
of the langhook which doesn't ICE but generates (only) "wrong"
debug info.  Better than ICEing, so I consider this good for 4.6.

In an ideal world we only ever would need to assign assembler names
to non-exported entities at link time.  And we could simply use the
same mechanism for LTO and all other frontends for such entities,
at LTO link time asserting that we never try that for exported entities.
But we are not there yet.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Ok?

Thanks,
Richard.

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.

Index: gcc/tree.c
===================================================================
*** gcc/tree.c	(revision 172705)
--- gcc/tree.c	(working copy)
*************** free_lang_data (void)
*** 5176,5182 ****
    lang_hooks.callgraph.analyze_expr = NULL;
    lang_hooks.dwarf_name = lhd_dwarf_name;
    lang_hooks.decl_printable_name = gimple_decl_printable_name;
!   lang_hooks.set_decl_assembler_name = lhd_set_decl_assembler_name;
  
    /* Reset diagnostic machinery.  */
    diagnostic_starter (global_dc) = default_tree_diagnostic_starter;
--- 5176,5187 ----
    lang_hooks.callgraph.analyze_expr = NULL;
    lang_hooks.dwarf_name = lhd_dwarf_name;
    lang_hooks.decl_printable_name = gimple_decl_printable_name;
!   /* We do not want the default decl_assembler_name implementation,
!      rather if we have fixed everything we want a wrapper around it
!      asserting that all non-local symbols already got their assembler
!      name and only produce assembler names for local symbols.  Or rather
!      make sure we never call decl_assembler_name on local symbols and
!      devise a separate, middle-end private scheme for it.  */
  
    /* Reset diagnostic machinery.  */
    diagnostic_starter (global_dc) = default_tree_diagnostic_starter;
Index: gcc/testsuite/g++.dg/lto/pr48207_0.C
===================================================================
*** gcc/testsuite/g++.dg/lto/pr48207_0.C	(revision 0)
--- gcc/testsuite/g++.dg/lto/pr48207_0.C	(revision 0)
***************
*** 0 ****
--- 1,13 ----
+ // { dg-lto-do link }
+ // { dg-lto-options { { -flto -g } } }
+ 
+ void bar(int) {}
+ 
+ void foo(void)
+ {
+   typedef enum { ABC } DEF;
+   DEF a;
+   bar((int)a);
+ }
+ 
+ int main() {}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]