http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56856
Bug #: 56856 Summary: the location of -Wformat warnings point *after* the format string Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: m...@gcc.gnu.org $ cc1plus gcc/testsuite/g++.dg/ext/builtin4.C -Wall gcc/testsuite/g++.dg/ext/builtin4.C:9:14: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=] printf("%d"); // { dg-warning "expects a matching" } ^ Unfortunately, the format_tree we get at the time of the warning does not seem to have a valid location either: (gdb) p debug_tree(format_tree) <nop_expr 0x7ffff7567660 type <pointer_type 0x7ffff741d9d8 type <integer_type 0x7ffff741d930 char readonly string-flag QI size <integer_cst 0x7ffff73f7f80 constant 8> unit size <integer_cst 0x7ffff73f7fa0 constant 1> align 8 symtab 0 alias set -1 canonical type 0x7ffff741d930 precision 8 min <integer_cst 0x7ffff73f7fe0 -128> max <integer_cst 0x7ffff7414020 127> pointer_to_this <pointer_type 0x7ffff741d9d8>> unsigned SI size <integer_cst 0x7ffff73f7dc0 constant 32> unit size <integer_cst 0x7ffff73f7de0 constant 4> align 32 symtab 0 alias set -1 canonical type 0x7ffff741d9d8 pointer_to_this <pointer_type 0x7ffff7420690>> readonly constant arg 0 <addr_expr 0x7ffff7567640 type <pointer_type 0x7ffff755dbd0 type <array_type 0x7ffff755da80> unsigned SI size <integer_cst 0x7ffff73f7dc0 32> unit size <integer_cst 0x7ffff73f7de0 4> align 32 symtab 0 alias set -1 canonical type 0x7ffff755dbd0> readonly constant arg 0 <string_cst 0x7ffff7565990 type <array_type 0x7ffff755da80> readonly constant static "%d\000">>>