https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77753
Bug ID: 77753 Summary: [7 Regression] broken profiledbootstrap due to -Werror=format-length in varasm.c:1573 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- Running profiledbootstrap on a ppc64le machine: ../../gcc/varasm.c: In function ‘void default_named_section_asm_out_destructor(rtx, int)’: ../../gcc/varasm.c:1573:1: error: ‘%.5u’ directive writing between 5 and 10 bytes into a region of size 9 [-Werror=format-length=] default_named_section_asm_out_destructor (rtx symbol, int priority) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gcc/varasm.c:1573:1: note: directive argument in the range [-2147418112, 2147483647] ../../gcc/varasm.c:1568:7: note: format output between 13 and 18 bytes into a destination of size 16 p); ^ ../../gcc/varasm.c: In function ‘void default_named_section_asm_out_constructor(rtx, int)’: ../../gcc/varasm.c:1596:1: error: ‘%.5u’ directive writing between 5 and 10 bytes into a region of size 9 [-Werror=format-length=] default_named_section_asm_out_constructor (rtx symbol, int priority) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gcc/varasm.c:1596:1: note: directive argument in the range [-2147418112, 2147483647] ../../gcc/varasm.c:1568:7: note: format output between 13 and 18 bytes into a destination of size 16 p); code snippet: char buf[16]; /* ??? This only works reliably with the GNU linker. */ sprintf (buf, "%s.%.5u", constructor_p ? ".ctors" : ".dtors", /* Invert the numbering so the linker puts us in the proper order; constructors are run from right to left, and the linker sorts in increasing order. */ MAX_INIT_PRIORITY - priority); I'm wondering whether "%.5u" format (limiting output to 5 digits) is really supported by sprintf? If not, I guess we should either increase buffer size. Can sprintf format check utilize VRP information?