--- sv.c 2020-09-29 22:29:16.781395700 +1000
+++ sv.c_mod 2020-10-02 11:35:20.728840400 +1000
@@ -13115,7 +13115,7 @@
&& intsize != 'q'
) {
WITH_LC_NUMERIC_SET_TO_NEEDED_IN(in_lc_numeric,
- SNPRINTF_G(fv, ebuf, sizeof(ebuf), precis)
+ PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
);
elen = strlen(ebuf);
eptr = ebuf;
####
cc -c -DPERL_CORE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 -O2 -Wall -Werror=pointer-arith -Wextra -Wc++-compat -Wwrite-strings -Werror=declaration-after-statement sv.c
##
##
#include
int main(void) {
char ebuf[127];
long double fv = 0.3L;
int precis = 54;
sprintf(ebuf, "%.*g", precis, (double) fv);
printf("%s\n", ebuf);
return 0;
}
##
##
In file included from sv.c:32:0:
sv.c: In function ‘Perl_sv_vcatpvfn_flags’:
sv.c:13118:54: warning: ‘%.*g’ directive writing between 1 and 133 bytes into a region of size 127 [-Wformat-overflow=]
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
perl.h:6791:13: note: in definition of macro ‘WITH_LC_NUMERIC_SET_TO_NEEDED_IN’
block; \
^~~~~
sv.c:13118:21: note: in expansion of macro ‘PERL_UNUSED_RESULT’
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
sv.c:13118:54: note: assuming directive output of 132 bytes
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
perl.h:6791:13: note: in definition of macro ‘WITH_LC_NUMERIC_SET_TO_NEEDED_IN’
block; \
^~~~~
sv.c:13118:21: note: in expansion of macro ‘PERL_UNUSED_RESULT’
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
In file included from /usr/include/stdio.h:862:0,
from perlio.h:41,
from iperlsys.h:50,
from perl.h:3934,
from sv.c:32:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 2 and 134 bytes into a destination of size 127
return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from sv.c:32:0:
sv.c:13118:54: warning: ‘%.*g’ directive writing between 1 and 133 bytes into a region of size 127 [-Wformat-overflow=]
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
perl.h:6791:13: note: in definition of macro ‘WITH_LC_NUMERIC_SET_TO_NEEDED_IN’
block; \
^~~~~
sv.c:13118:21: note: in expansion of macro ‘PERL_UNUSED_RESULT’
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
sv.c:13118:54: note: assuming directive output of 132 bytes
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
perl.h:6791:13: note: in definition of macro ‘WITH_LC_NUMERIC_SET_TO_NEEDED_IN’
block; \
^~~~~
sv.c:13118:21: note: in expansion of macro ‘PERL_UNUSED_RESULT’
PERL_UNUSED_RESULT(sprintf(ebuf, "%.*g", (int)precis, (NV) fv))
^
In file included from /usr/include/stdio.h:862:0,
from perlio.h:41,
from iperlsys.h:50,
from perl.h:3934,
from sv.c:32:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 2 and 134 bytes into a destination of size 127
return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());