The return type of __builtin_va_start is incorrectly set to _Bool, rather than void. The attached patch (with testcase) fixes it.

OK to commit?

Enea.
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp	(revision 192535)
+++ lib/Sema/SemaChecking.cpp	(working copy)
@@ -1648,6 +1648,7 @@
     Diag(ParamLoc, diag::note_parameter_type) << Type;
   }
 
+  TheCall->setType(Context.VoidTy);
   return false;
 }
 
Index: test/Sema/varargs.c
===================================================================
--- test/Sema/varargs.c	(revision 192535)
+++ test/Sema/varargs.c	(working copy)
@@ -76,3 +76,10 @@
     (void)__builtin_va_arg(args, short); // expected-warning {{second argument to 'va_arg' is of promotable type 'short'}}
     (void)__builtin_va_arg(args, char); // expected-warning {{second argument to 'va_arg' is of promotable type 'char'}}
 }
+
+void f10(int a, ...) {
+  int i;
+  __builtin_va_list ap;
+  i = __builtin_va_start(ap, a); // expected-error {{assigning to 'int' from incompatible type 'void'}}
+  __builtin_va_end(ap);
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to