diff options
author | Qing Zhao <qing.zhao@oracle.com> | 2017-12-14 17:37:20 +0000 |
---|---|---|
committer | Qing Zhao <qinzhao@gcc.gnu.org> | 2017-12-14 17:37:20 +0000 |
commit | 2004617a8c2e67005230ebfcbdd1e4216b411bf1 (patch) | |
tree | 707f59bba7756a18a71f663acf1e92c0218c53c4 /libatomic/ChangeLog | |
parent | 65fe74706ffbd4d51bf31add434843b1991b2b39 (diff) | |
download | gcc-2004617a8c2e67005230ebfcbdd1e4216b411bf1.tar.gz |
Patch for middle-end/PR79538
missing -Wformat-overflow with %s and non-member array arguments
-Wformat-overflow uses the routine "get_range_strlen" to decide the
maximum string length, however, currently "get_range_strlen" misses
the handling of non-member arrays.
Adding the handling of non-member array resolves the issue.
Adding test case pr79538.c into gcc.dg.
During gcc bootstrap, 2 source files (c-family/c-cppbuiltin.c,
fortran/class.c) were detected new warnings by -Wformat-overflow
due to the new handling of non-member array in "get_range_strlen".
in order to avoid these new warnings and continue with bootstrap,
updating these 2 files to avoid the warnings.
in c-family/c-cppbuiltin.c, the warning is following:
../../latest_gcc_2/gcc/c-family/c-cppbuiltin.c:1627:15: note:
‘sprintf’ output 2 or more bytes (assuming 257) into a destination
of size 256
sprintf (buf1, "%s=%s", macro, buf2);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
in the above, buf1 and buf2 are declared as:
char buf1[256], buf2[256];
i.e, buf1 and buf2 have same size. adjusting the size of buf1 and
buf2 resolves the warning.
fortran/class.c has the similar issue as above. Instead of adjusting
size of the buffers, replacing sprintf with xasprintf is a better
solution for these cases.
From-SVN: r255654
Diffstat (limited to 'libatomic/ChangeLog')
0 files changed, 0 insertions, 0 deletions