Hi!

In C++, if there are no parameters, params can be non-NULL, but still
empty vector.  Fixed by properly testing for empty vector.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-02-15  Jakub Jelinek  <ja...@redhat.com>

        PR c++/69797
        * c-common.c (sync_resolve_size): Diagnose too few arguments
        even when params is non-NULL empty vector.

        * c-c++-common/pr69797.c: New test.

--- gcc/c-family/c-common.c.jj  2016-02-08 18:39:17.000000000 +0100
+++ gcc/c-family/c-common.c     2016-02-15 14:56:14.518790242 +0100
@@ -10675,7 +10675,7 @@ sync_resolve_size (tree function, vec<tr
   tree type;
   int size;
 
-  if (!params)
+  if (vec_safe_is_empty (params))
     {
       error ("too few arguments to function %qE", function);
       return 0;
--- gcc/testsuite/c-c++-common/pr69797.c.jj     2016-02-15 14:57:31.244745664 
+0100
+++ gcc/testsuite/c-c++-common/pr69797.c        2016-02-15 14:57:11.000000000 
+0100
@@ -0,0 +1,8 @@
+/* PR c++/69797 */
+/* { dg-do compile } */
+
+void
+foo () 
+{
+  __atomic_fetch_add ();       /* { dg-error "too few arguments to function" } 
*/
+}

        Jakub

Reply via email to