[hsa-branch 5/9] Properly detect variadic arguments

Martin Jambor mjambor@suse.cz
Mon Oct 10 16:09:00 GMT 2016


Hi,

this patch from Martin properly detects some variadic calls which we have
failed to detect before during expansion to HSAIL.

Committed to the branch, queued for merge to trunk soon.
Thanks,

Martin

2016-10-03  Martin Liska  <mliska@suse.cz>
	    Martin Jambor  <mjambor@suse.cz>

	* hsa-gen.c (verify_function_arguments): Properly detect variadic
	arguments.
---
 gcc/hsa-gen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index efb87a0..ac83e9e 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -3444,13 +3444,14 @@ gen_hsa_insns_for_switch_stmt (gswitch *s, hsa_bb *hbb)
 static void
 verify_function_arguments (tree decl)
 {
+  tree type = TREE_TYPE (decl);
   if (DECL_STATIC_CHAIN (decl))
     {
       HSA_SORRY_ATV (EXPR_LOCATION (decl),
 		     "HSA does not support nested functions: %D", decl);
       return;
     }
-  else if (!TYPE_ARG_TYPES (TREE_TYPE (decl)))
+  else if (!TYPE_ARG_TYPES (type) || stdarg_p (type))
     {
       HSA_SORRY_ATV (EXPR_LOCATION (decl),
 		     "HSA does not support functions with variadic arguments "
-- 
2.10.0



More information about the Gcc-patches mailing list