]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Properly handle function without arguments
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 29 Nov 2013 13:00:35 +0000 (13:00 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 29 Nov 2013 13:00:35 +0000 (05:00 -0800)
PR c/59309
* cilk.c (gimplify_cilk_spawn): Properly handle function without
arguments.

From-SVN: r205525

gcc/c-family/ChangeLog
gcc/c-family/cilk.c

index 12db5210aaf0b9d6357c278f43f19417be6f97fe..616a74209c04b4ad0956d323ac5e2225510f6f27 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-29   H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR c/59309
+       * cilk.c (gimplify_cilk_spawn): Properly handle function without
+       arguments.
+
 2013-11-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/59280
index c85b5f2a7c9a8773a5fdb362ab3b6cd4592c406f..99d9c7e354d6a8aa5fe3ccdc596bb537e46b2e2a 100644 (file)
@@ -757,7 +757,10 @@ gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED,
 
   /* This should give the number of parameters.  */
   total_args = list_length (new_args);
-  arg_array = XNEWVEC (tree, total_args);
+  if (total_args)
+    arg_array = XNEWVEC (tree, total_args);
+  else
+    arg_array = NULL;
 
   ii_args = new_args;
   for (ii = 0; ii < total_args; ii++)
@@ -771,7 +774,7 @@ gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED,
 
   call1 = cilk_call_setjmp (cfun->cilk_frame_decl);
 
-  if (*arg_array == NULL_TREE)
+  if (arg_array == NULL || *arg_array == NULL_TREE)
     call2 = build_call_expr (function, 0);
   else 
     call2 = build_call_expr_loc_array (EXPR_LOCATION (*spawn_p), function,