GCC patch committed: For DIE for function, use first matching variant

Ian Lance Taylor via gcc-patches gcc-patches@gcc.gnu.org
Mon Jan 30 22:41:00 GMT 2017


After the patch of 2016-11-03, gen_type_die_with_usage picks a variant
to use for the DIE for a FUNCTION_TYPE or METHOD_TYPE, as does
modified_type_die.  The two need to pick the same variant, otherwise
modified_type_die will not find the DIE that was written earlier.
Unfortunately the loops were written such that gen_type_die_with_usage
used the last matching variant and modified_type_die used the first
matching variant.  This caused PR 79289.  This patch changes
gen_type_die_with_usage to use the first matching variant.
Bootstrapped and tested on x86_64-pc-linux-gnu.  Committed to
mainline.

Ian

2017-01-30  Ian Lance Taylor  <iant@google.com>

PR debug/79289
* dwarf2out.c (gen_type_die_with_usage): When picking a variant
for FUNCTION_TYPE/METHOD_TYPE, use the first matching one.
-------------- next part --------------
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 245036)
+++ gcc/dwarf2out.c	(working copy)
@@ -24453,8 +24453,13 @@
 	 but try to canonicalize.  */
       tree main = TYPE_MAIN_VARIANT (type);
       for (tree t = main; t; t = TYPE_NEXT_VARIANT (t))
-	if (check_base_type (t, main) && check_lang_type (t, type))
-	  type = t;
+	{
+	  if (check_base_type (t, main) && check_lang_type (t, type))
+	    {
+	      type = t;
+	      break;
+	    }
+	}
     }
   else if (TREE_CODE (type) != VECTOR_TYPE
 	   && TREE_CODE (type) != ARRAY_TYPE)


More information about the Gcc-patches mailing list