> Looks good to me.  Rather than removing dwarf2/pr37726.c can you try
> turning that into a guality test that verifies the debug experience is the
> same (or better) than before?  I realize guality stuff is fragile but you
> can restrict it to -O0 if you like (not sure if dg-skip-if supports that).

Gah.  I got caught by "make -k check-fortran" not running the Fortran part of 
libgomp and missed the handful of ICEs in the Fortran part of libgomp...

It turns out that omp-low.c uses lots of and chains of DECL_VALUE_EXPRs (w or 
w/o my change) and trips over the assertions, so I have applied the attached 
patch to revert the problematic changes for now.  I'll further think about it.


        * tree.c (decl_value_expr_lookup): Revert latest change.
        (decl_value_expr_insert): Likewise.
fortran/
        * trans-decl.c (gfc_get_fake_result_decl): Revert latest change.

-- 
Eric Botcazou
Index: tree.c
===================================================================
--- tree.c	(revision 261686)
+++ tree.c	(revision 261687)
@@ -6337,7 +6337,15 @@ decl_value_expr_lookup (tree from)
 
   h = value_expr_for_decl->find_with_hash (&in, DECL_UID (from));
   if (h)
-    return h->to;
+    {
+      /* Chains of value expressions may run afoul of garbage collection.  */
+      gcc_checking_assert (!(h->to
+			     && (TREE_CODE (h->to) == PARM_DECL
+				 || TREE_CODE (h->to) == VAR_DECL)
+			     && DECL_HAS_VALUE_EXPR_P (h->to)));
+      return h->to;
+    }
+
   return NULL_TREE;
 }
 
@@ -6348,6 +6356,12 @@ decl_value_expr_insert (tree from, tree
 {
   struct tree_decl_map *h;
 
+  /* Chains of value expressions may run afoul of garbage collection.  */
+  gcc_checking_assert (!(to
+			 && (TREE_CODE (to) == PARM_DECL
+			     || TREE_CODE (to) == VAR_DECL)
+			 && DECL_HAS_VALUE_EXPR_P (to)));
+
   h = ggc_alloc<tree_decl_map> ();
   h->base.from = from;
   h->to = to;
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c	(revision 261686)
+++ fortran/trans-decl.c	(revision 261687)
@@ -2950,13 +2908,14 @@ gfc_get_fake_result_decl (gfc_symbol * s
       && sym->ns->proc_name->attr.entry_master
       && sym != sym->ns->proc_name)
     {
-      tree t = NULL, var;
+      tree t = NULL, var, field;
       if (this_fake_result_decl != NULL)
 	for (t = TREE_CHAIN (this_fake_result_decl); t; t = TREE_CHAIN (t))
 	  if (strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t)), sym->name) == 0)
 	    break;
       if (t)
 	return TREE_VALUE (t);
+
       decl = gfc_get_fake_result_decl (sym->ns->proc_name, parent_flag);
 
       if (parent_flag)
@@ -2964,20 +2923,17 @@ gfc_get_fake_result_decl (gfc_symbol * s
       else
 	this_fake_result_decl = current_fake_result_decl;
 
-      if (decl && sym->ns->proc_name->attr.mixed_entry_master)
-	{
-	  tree field;
-
-	  for (field = TYPE_FIELDS (TREE_TYPE (decl));
-	       field; field = DECL_CHAIN (field))
-	    if (strcmp (IDENTIFIER_POINTER (DECL_NAME (field)),
-		sym->name) == 0)
-	      break;
+      if (!sym->ns->proc_name->attr.mixed_entry_master)
+	return decl;
 
-	  gcc_assert (field != NULL_TREE);
-	  decl = fold_build3_loc (input_location, COMPONENT_REF,
-				  TREE_TYPE (field), decl, field, NULL_TREE);
-	}
+      for (field = TYPE_FIELDS (TREE_TYPE (decl));
+	   field; field = DECL_CHAIN (field))
+	if (strcmp (IDENTIFIER_POINTER (DECL_NAME (field)), sym->name) == 0)
+	  break;
+
+      gcc_assert (field != NULL_TREE);
+      decl = fold_build3_loc (input_location, COMPONENT_REF,
+			      TREE_TYPE (field), decl, field, NULL_TREE);
 
       var = create_tmp_var_raw (TREE_TYPE (decl), sym->name);
       if (parent_flag)

Reply via email to