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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-09-27
                 CC|                            |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/gimple-ssa-sprintf.c.jj 2016-09-23 09:32:13.000000000 +0200
+++ gcc/gimple-ssa-sprintf.c    2016-09-27 23:21:50.510412845 +0200
@@ -2536,8 +2536,8 @@ pass_sprintf_length::handle_gimple_call
       // Signature:
       //   __builtin___vsnprintf_chk (dst, size, ost, objsize, format, va)
       idx_dstsize = 1;
-      idx_objsize = 2;
-      idx_format = 3;
+      idx_objsize = 3;
+      idx_format = 4;
       info.argidx = -1;
       info.bounded = true;
       break;

seems to fix this.  Though I wonder why this warning at all, I don't see
anything -Wformat-length related on what it complains about, and generally, it
isn't disallowed to pass larger size than what -D_FORTIFY_SOURCE=2 is able to
compute, all that matters is whether the string at runtime exceeds the __bos
size (then it is __chk_fail runtime abort), or if it exceeds the user supplied
length (then it is truncated).

Reply via email to