[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2

From: Ken Brown
Subject: bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2
Date: Thu, 19 Jul 2018 08:49:33 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 7/19/2018 2:10 AM, Philipp Stephani wrote:
Ken Brown <address@hidden <mailto:address@hidden>> schrieb am Mi., 18. Juli 2018 um 21:44 Uhr:

    $ cat test.c
    #include <stdio.h>
    main ()
        char buffer[16];
        short a;
        snprintf (buffer, 16, "%3.1f", a);

This is undefined behavior, as %f requires a double argument.

Then cast the argument to double; this doesn't change the warning, which claims that the output could be 312 bytes.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]