This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/79082] -Wformat-truncation inconsistent behaviour


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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
I see no warning at -O0 on

  snprintf (buffer, 4, "%03hx", val & 0xfff);

or at -O2 on:

  snprintf (buffer, 3, "%2d", (val < 0) ? -(val % 100) : val % 100);

(It does warn at -O0 as expected.)  This is on x86_64 (both ILP32 and LP64) but
there are known issues in VRP that have been seen to lead to false positives.

What target are you seeing false positives on and with what revision?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]