r326622 - Don't claim that va_start has special semantic checks

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 3 12:16:32 PST 2018


The 't' was there because __builtin_va_start and __va_start had them, but
those do in fact have custom sema checking so copying that was in fact
incorrect. Thanks for fixing my bugs!

On Fri, Mar 2, 2018 at 4:41 PM, Reid Kleckner via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: rnk
> Date: Fri Mar  2 13:41:08 2018
> New Revision: 326622
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326622&view=rev
> Log:
> Don't claim that va_start has special semantic checks
>
> We don't have special checks for BI_va_start in
> Sema::CheckBuiltinFunctionCall, so setting the 't' flag for va_start in
> Builtins.def disables semantic checking for it. That's not desired, and
> IRGen crashes when it tries to generate a call to va_start that doesn't
> have at least one argument.
>
> Follow-up to r322573
>
> Fixes PR36565
>
> Modified:
>     cfe/trunk/include/clang/Basic/Builtins.def
>     cfe/trunk/test/Sema/varargs.c
>
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Basic/Builtins.def?rev=326622&r1=326621&r2=326622&view=diff
> ============================================================
> ==================
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Fri Mar  2 13:41:08 2018
> @@ -803,7 +803,7 @@ LIBBUILTIN(_setjmpex, "iJ", "fj",   "set
>
>  // C99 library functions
>  // C99 stdarg.h
> -LIBBUILTIN(va_start, "vA.",       "fnt",   "stdarg.h", ALL_LANGUAGES)
> +LIBBUILTIN(va_start, "vA.",       "fn",    "stdarg.h", ALL_LANGUAGES)
>  LIBBUILTIN(va_end, "vA",          "fn",    "stdarg.h", ALL_LANGUAGES)
>  LIBBUILTIN(va_copy, "vAA",        "fn",    "stdarg.h", ALL_LANGUAGES)
>  // C99 stdlib.h
>
> Modified: cfe/trunk/test/Sema/varargs.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/
> varargs.c?rev=326622&r1=326621&r2=326622&view=diff
> ============================================================
> ==================
> --- cfe/trunk/test/Sema/varargs.c (original)
> +++ cfe/trunk/test/Sema/varargs.c Fri Mar  2 13:41:08 2018
> @@ -112,3 +112,12 @@ void f13(enum E1 e, ...) {
>  #endif
>    __builtin_va_end(va);
>  }
> +
> +void f14(int e, ...) {
> +  // expected-warning at +3 {{implicitly declaring library function
> 'va_start'}}
> +  // expected-note at +2 {{include the header <stdarg.h>}}
> +  // expected-error at +1 {{too few arguments to function call}}
> +  va_start();
> +  __builtin_va_list va;
> +  va_start(va, e);
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180303/3dd60110/attachment.html>


More information about the cfe-commits mailing list