diff mbox

[Commitred] Fix PR target/48767

Message ID 20110427.072650.318057926.kkojima@rr.iij4u.or.jp
State New
Headers show

Commit Message

Kaz Kojima April 26, 2011, 10:26 p.m. UTC
Hi,

The attached target specific patch is to fix PR target/48767.
In the problematic case, sh.c:sh_gimplify_va_arg_expr calls
targetm.calls.must_pass_in_stack with void type as its 2nd
argument which is unexpected by the callee.  The patch is
tested on sh4-unknown-linux-gnu with no new failures.
Applied on trunk.

Regards,
	kaz
--
2011-04-26  Kaz Kojima  <kkojima@gcc.gnu.org>

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

Comments

Joseph Myers April 26, 2011, 10:30 p.m. UTC | #1
I think you should add a testcase to gcc.c-torture/compile, unless there 
is already one that this patch fixes.
diff mbox

Patch

--- 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);