Ok, the main calculation in the perl source is I think this statement from sv.c:
/* Determine the buffer size needed for the various
* floating-point formats.
* The basic possibilities are:
* %f 1111111.123456789
* %e 1.111111123e+06
* %a 0x1.0f4471f9bp+20
* %g 1111111.12
* %g 1.11111112e+15
* where P is the value of the precision in the format, or
* if not specified. Note the two possible output formats
* %g; in both cases the number of significant digits is <
* For most of the format types the maximum buffer size ne
* is precision, plus: any leading 1 or 0x1, the radix
* point, and an exponent. The difficult one is %f: for a
* large positive exponent it can have many leading digits
* which needs to be calculated specially. Also %a is slig
* different in that in the absence of a specified precisi
* it uses as many digits as necessary to distinguish
* different values.
* First, here are the constant bits. For ease of calculat
* we over-estimate the needed buffer size, for example by
* assuming all formats have an exponent and a leading 0x1
* Also for production use, add a little extra overhead fo
* safety's sake. Under debugging don't, as it means we're
* more likely to quickly spot issues during development.
float_need = 1 /* possible unary minus */
+ 4 /* "0x1" plus very unlikely carry */
+ 1 /* default radix point '.' */
+ 2 /* "e-", "p+" etc */
+ 6 /* exponent: up to 16383 (quad fp) */
+ 20 /* safety net */
+ 1; /* \0 */
.. after which if we are subject to locale it goes and checks the actual length of the utf8 representation of the radix point and adjusts that "+ 1" for the default. The above adds up to 35, which is pretty close to the difference between 91 and 127.
The origin of the gcc warning looks like it might be gimple-ssa-sprintf.c or a close relative, in which case the "#define target_mb_len_max() 6" may well explain the difference between 127 and 133.
So this looks pretty safe to me - and you'd certainly need a debugging perl to get close to exercising the limits.
That just leaves the question of whether we can give the compiler enough hints for it to come to the same conclusion, or whether we'd only be able to shut it up with a sledgehammer preprocessor directive.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.