[LLVMbugs] [Bug 4287] New: Varargs + K&R doesn't work nicely
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun May 31 14:45:41 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4287
Summary: Varargs + K&R doesn't work nicely
Product: clang
Version: unspecified
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P2
Component: Semantic Analyzer
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ed at 80386.nl
CC: llvmbugs at cs.uiuc.edu
Blocks: 3696
The following code doesn't build with Clang, while it does build when using
GCC. This causes some build failures when building packages for FreeBSD:
#include <stdarg.h>
char *foo = "test";
#if defined(__STDC__) && __STDC__
int test(char*,...);
#endif
int test(fmt)
char*fmt;
{
va_list ap;
char*a;
int x;
va_start(ap,fmt);
a=va_arg(ap,char*);
x=(a!=foo);
va_end(ap);
return x;
}
int main(argc,argv)
int argc;char**argv;
{
exit(test("",foo));
}
Error log:
conftest.c:7:5: error: conflicting types for 'test'
int test(fmt)
^
conftest.c:4:5: note: previous declaration is here
int test(char*,...);
^
conftest.c:14:2: error: 'va_start' used in function with fixed args
va_start(ap,fmt);
^
/usr/include/stdarg.h:45:2: note: instantiated from:
__builtin_va_start((ap), (last))
^
3 diagnostics generated.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list