https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68737

--- Comment #9 from dave.anglin at bell dot net ---
On 2018-09-04 6:38 AM, redi at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68737
>
> --- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Could you see what this prints on the target please?
# ./test
using vsnprintf
returned 4, errno = 0

>
> #include <cerrno>
>
> int
> getlen(char* __out, int __size __attribute__((unused)), const char* __fmt, 
> ...)
> {
>    __builtin_va_list __args;
>    __builtin_va_start(__args, __fmt);
>
> #if _GLIBCXX_USE_C99_STDIO
>    __builtin_puts("using vsnprintf");
>    const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
> #else
>    __builtin_puts("using vsprintf");
>    const int __ret = __builtin_vsprintf(__out, __fmt, __args);
> #endif
>    return __ret;
> }
>
> int main()
> {
>    char out[64];
>    errno = 0;
>    int len = getlen(out, 0, "%.*g", 6, 1.99);
>    __builtin_printf("returned %d, errno = %d\n", len, errno);
> }
>

Reply via email to