> Jan,
>      This patch caused Bug 64982 - [5 Regression] Many g++ failures on
> x86_64-apple-darwin14 with -m32.
>                    Jack

Hi,
I think best way would be to move the warning to middle-end when the thunk is 
being
expanded (other alternative is just to force analysis before doing the sanity 
check
in cp/method.c.
I had to dro # in the error message, I am not quite sure what it means.
Jason, what do you think?

Honza

Index: cp/method.c
===================================================================
--- cp/method.c (revision 220547)
+++ cp/method.c (working copy)
@@ -418,20 +418,6 @@ use_thunk (tree thunk_fndecl, bool emit_
   if (DECL_ONE_ONLY (function))
     thunk_node->add_to_same_comdat_group (funcn);
 
-  if (!this_adjusting
-      || !targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
-                                              virtual_value, alias))
-    {
-      /* If this is a covariant thunk, or we don't have the necessary
-        code for efficient thunks, generate a thunk function that
-        just makes a call to the real function.  Unfortunately, this
-        doesn't work for varargs.  */
-
-      if (varargs_function_p (function))
-       error ("generic thunk code fails for method %q#D which uses %<...%>",
-              function);
-    }
-
   pop_from_top_level ();
 }
 
Index: cgraphunit.c
===================================================================
--- cgraphunit.c        (revision 220547)
+++ cgraphunit.c        (working copy)
@@ -1559,6 +1559,14 @@ cgraph_node::expand_thunk (bool output_a
       thunk.thunk_p = false;
       analyzed = false;
     }
+  else if (stdarg_p (TREE_TYPE (thunk_fndecl)))
+    {
+      error ("generic thunk code fails for method %qD which uses %<...%>",
+            thunk_fndecl);
+      TREE_ASM_WRITTEN (thunk_fndecl) = 1;
+      analyzed = true;
+      return false;
+    }
   else
     {
       tree restype;

Reply via email to