[Bug c/77675] New: optimization level==number of -Wformat-length warnings
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 21 11:24:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77675
Bug ID: 77675
Summary: optimization level==number of -Wformat-length warnings
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: trippels at gcc dot gnu.org
Target Milestone: ---
Created attachment 39666
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39666&action=edit
unreduced testcase
Consider the attached unreduced testcase. The number of redundant warnings
increases with the -O level due to inlining:
markus@x4 /tmp % gcc -O1 -c -Wformat-length algapi.i
crypto/algapi.c: In function ‘crypto_inst_setname’:
crypto/algapi.c:817:6: warning: output may be truncated at or before format
character ‘)’ at offset 5 [-Wformat-length=]
crypto/algapi.c:817:6: note: format output between 3 and 66 bytes into a
destination of size 64
markus@x4 /tmp % cc -O2 -c -Wformat-length algapi.i
crypto/algapi.c: In function ‘crypto_inst_setname’:
crypto/algapi.c:817:6: warning: output may be truncated at or before format
character ‘)’ at offset 5 [-Wformat-length=]
crypto/algapi.c:817:6: note: format output between 3 and 66 bytes into a
destination of size 64
crypto/algapi.c: In function ‘crypto_alloc_instance2’:
crypto/algapi.c:817:6: warning: output may be truncated at or before format
character ‘)’ at offset 5 [-Wformat-length=]
crypto/algapi.c:817:6: note: format output between 3 and 66 bytes into a
destination of size 64
markus@x4 /tmp % gcc -O3 -c -Wformat-length algapi.i
crypto/algapi.c: In function ‘crypto_inst_setname’:
crypto/algapi.c:817:6: warning: output may be truncated at or before format
character ‘)’ at offset 5 [-Wformat-length=]
crypto/algapi.c:817:6: note: format output between 3 and 66 bytes into a
destination of size 64
crypto/algapi.c: In function ‘crypto_alloc_instance2’:
crypto/algapi.c:817:6: warning: output may be truncated at or before format
character ‘)’ at offset 5 [-Wformat-length=]
crypto/algapi.c:817:6: note: format output between 3 and 66 bytes into a
destination of size 64
crypto/algapi.c: In function ‘crypto_alloc_instance’:
crypto/algapi.c:817:6: warning: output may be truncated at or before format
character ‘)’ at offset 5 [-Wformat-length=]
crypto/algapi.c:817:6: note: format output between 3 and 66 bytes into a
destination of size 64
More information about the Gcc-bugs
mailing list