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] Fix Java with LTO


This re-syncs java_mange_decl with lhd_set_decl_assembler_name.

Committed as obvious.

Otherwise testing with -flto fails in libjava testing with

^[[01m^[[K<built-in>:^[[m^[[K ^[[01;31m^[[Kinternal compiler error: 
^[[m^[[Kin java_mangle_decl, at java/mangle.c:84^M
0x63a513 java_mangle_decl(tree_node*)^M
        /space/rguenther/src/svn/trunk/gcc/java/mangle.c:80^M
0xd3b9f0 decl_assembler_name(tree_node*)^M
        /space/rguenther/src/svn/trunk/gcc/tree.c:669^M
0xd615c7 assign_assembler_name_if_neeeded(tree_node*)^M
        /space/rguenther/src/svn/trunk/gcc/tree.c:5919^M
0xd63c19 free_lang_data_in_cgraph^M
        /space/rguenther/src/svn/trunk/gcc/tree.c:5968^M
0xd63c19 free_lang_data^M
        /space/rguenther/src/svn/trunk/gcc/tree.c:6005^M

Richard.

2016-08-26  Richard Biener  <rguenther@suse.de>

	java/
	* mangle.c (java_mangle_decl): Re-sync with lhd_set_decl_assembler_name.

Index: gcc/java/mangle.c
===================================================================
--- gcc/java/mangle.c	(revision 239754)
+++ gcc/java/mangle.c	(working copy)
@@ -74,15 +74,23 @@ static GTY(()) tree atms;
 void
 java_mangle_decl (tree decl)
 {
-  /* A copy of the check from the beginning of lhd_set_decl_assembler_name.
-     Only FUNCTION_DECLs and VAR_DECLs for variables with static storage
-     duration need a real DECL_ASSEMBLER_NAME.  */
+  /* A copy of the check from the beginning of lhd_set_decl_assembler_name.  */
+
+  /* set_decl_assembler_name may be called on TYPE_DECL to record ODR
+     name for C++ types.  By default types have no ODR names.  */
+  if (TREE_CODE (decl) == TYPE_DECL)
+    return;
+
+  /* The language-independent code should never use the
+     DECL_ASSEMBLER_NAME for lots of DECLs.  Only FUNCTION_DECLs and
+     VAR_DECLs for variables with static storage duration need a real
+     DECL_ASSEMBLER_NAME.  */
   gcc_assert (TREE_CODE (decl) == FUNCTION_DECL
 	      || (TREE_CODE (decl) == VAR_DECL
 		  && (TREE_STATIC (decl)
 		      || DECL_EXTERNAL (decl)
 		      || TREE_PUBLIC (decl))));
-  
+
   /* Mangling only applies to class members.  */
   if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)))
     {


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