Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test: 3C inserts syntactically invalid casts into valist.c on Windows #450

Open
mattmccutchen-cci opened this issue Feb 25, 2021 · 1 comment
Assignees
Labels
bug Something isn't working cast varargs

Comments

@mattmccutchen-cci
Copy link
Member

3C inserts syntactically invalid casts to __builtin_va_list & into valist.c on Windows:

--- valist.c    2021-02-21 11:13:09.584208800 -0500
+++ valist.checked.c    2021-02-25 08:52:06.325658600 -0500
@@ -1,29 +1,29 @@
 // RUN: rm -rf %t*
 // RUN: 3c -base-dir=%S -alltypes -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_ALL","CHECK" %s
 // RUN: 3c -base-dir=%S -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
 // RUN: 3c -base-dir=%S -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
 // RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
 // RUN: 3c -base-dir=%t.checked -alltypes %t.checked/valist.c -- | diff %t.checked/valist.c -
 
 #include <stdarg.h>
 typedef int lua_State;
 extern void lua_lock(lua_State *);
 extern void luaC_checkGC(lua_State *);
 extern void lua_unlock(lua_State *);
 extern const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp);
-const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
+const char *lua_pushfstring(lua_State *L : itype(_Ptr<lua_State>), const char *fmt : itype(_Ptr<const char>), ...) : itype(_Ptr<const char>) {
        //CHECK: const char *lua_pushfstring(lua_State *L : itype(_Ptr<lua_State>), const char *fmt : itype(_Ptr<const char>), ...) : itype(_Ptr<const char>) {
   const char *ret;
        //CHECK: const char *ret;
   va_list argp;
   lua_lock(L);
-  va_start(argp, fmt);
+  va_start(((__builtin_va_list & )argp), fmt);
   ret = luaO_pushvfstring(L, fmt, argp);
-  va_end(argp);
+  va_end(((__builtin_va_list & )argp));
   luaC_checkGC(L);
   lua_unlock(L);
   return ret;
 }
 /*force output*/
-int *p;
+_Ptr<int> p = ((void *)0);
        //CHECK: _Ptr<int> p = ((void *)0);

I haven't investigated why that is happening or what __builtin_va_list & even means.

@mattmccutchen-cci mattmccutchen-cci added bug Something isn't working cast windows failure A bug causing a Windows-specific failure in the regression tests labels Feb 25, 2021
@john-h-kastner john-h-kastner self-assigned this Feb 25, 2021
@john-h-kastner
Copy link
Collaborator

Once issue #459 is fixed, the test case for that issue will also act as a regression test for this issue that can be run on linux.

@john-h-kastner john-h-kastner removed the windows failure A bug causing a Windows-specific failure in the regression tests label Feb 26, 2021
@mattmccutchen-cci mattmccutchen-cci changed the title 3C inserts syntactically invalid casts into valist.c on Windows Add regression test: 3C inserts syntactically invalid casts into valist.c on Windows Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cast varargs
Projects
None yet
Development

No branches or pull requests

2 participants