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 bootstrap/77753] [7 Regression] broken profiledbootstrap due to -Werror=format-length in varasm.c:1573


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2016-09-27
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The precision in integer directives "...gives the minimum number of digits to
appear for the d, i, o, u, x, and X conversion specifiers..." so the warning
seems justified to me (in as much as the warning pass can see).  The buffer
size should be increased to 18 bytes to avoid the potential overflow when the
magnitude of (MAX_INIT_PRIORITY - priority) approaches INT_MAX.

Alternatively, if the priority is in some subrange of [INT_MIN, INT_MAX] it
could be constrained so that the gimple-ssa-sprintf pass can see it (e.g., by
changing the argument type or casting it to a type with a smaller precision). 
This may or may not work depending on whether the range information for the
expression is available (the pass does make use of VRP results but they are
often bogus).

It's usually simpler and safer to increase the size of the buffer so unless
there's some concern with it I'll post a patch to do that.

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