[cfe-commits] r55083 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/va_arg_x86_64.c
Eli Friedman
eli.friedman at gmail.com
Wed Aug 20 15:17:17 PDT 2008
Author: efriedma
Date: Wed Aug 20 17:17:17 2008
New Revision: 55083
URL: http://llvm.org/viewvc/llvm-project?rev=55083&view=rev
Log:
Fix a regression from my fix to PR2631. Fixes PR2692.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/va_arg_x86_64.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=55083&r1=55082&r2=55083&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Aug 20 17:17:17 2008
@@ -2613,6 +2613,8 @@
// a pointer for va_arg.
if (VaListType->isArrayType())
VaListType = Context.getArrayDecayedType(VaListType);
+ // Make sure the input expression also decays appropriately.
+ UsualUnaryConversions(E);
if (CheckAssignmentConstraints(VaListType, E->getType()) != Compatible)
return Diag(E->getLocStart(),
Modified: cfe/trunk/test/Sema/va_arg_x86_64.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/va_arg_x86_64.c?rev=55083&r1=55082&r2=55083&view=diff
==============================================================================
--- cfe/trunk/test/Sema/va_arg_x86_64.c (original)
+++ cfe/trunk/test/Sema/va_arg_x86_64.c Wed Aug 20 17:17:17 2008
@@ -1,6 +1,16 @@
// RUN: clang -fsyntax-only -verify -triple=x86_64-unknown-freebsd7.0 %s
+// PR2631
char* foo(char *fmt, __builtin_va_list ap)
{
return __builtin_va_arg((ap), char *);
}
+
+// PR2692
+typedef __builtin_va_list va_list;
+static char *f (char * (*g) (char **, int), char **p, ...) {
+ char *s;
+ va_list v;
+ s = g (p, __builtin_va_arg(v, int));
+}
+
More information about the cfe-commits
mailing list