http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48767

Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|sh4-linux-gnu               |sh*-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.04.26 09:26:30
          Component|c                           |target
               Host|sh4-linux-gnu               |
     Ever Confirmed|0                           |1
              Build|sh4-linux-gnu               |

--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-04-26 
09:26:30 UTC ---
This is a target problem.  The patch below will fix it.
BTW, I'm not sure that it's an invalid use of void or not in C,
though g++ treats it as invalid.

       * config/sh/sh.c (sh_gimplify_va_arg_expr): Don't call
       targetm.calls.must_pass_in_stack for void type.

--- ORIG/trunk/gcc/config/sh/sh.c    2011-04-23 09:43:19.000000000 +0900
+++ trunk/gcc/config/sh/sh.c    2011-04-26 10:40:25.000000000 +0900
@@ -8062,9 +8062,14 @@ sh_gimplify_va_arg_expr (tree valist, tr
   HOST_WIDE_INT size, rsize;
   tree tmp, pptr_type_node;
   tree addr, lab_over = NULL, result = NULL;
-  int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+  bool pass_by_ref;
   tree eff_type;

+  if (!VOID_TYPE_P (type))
+    pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+  else
+    pass_by_ref = false;
+
   if (pass_by_ref)
     type = build_pointer_type (type);

Reply via email to