https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71870

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The following output with my WIP patch for bug 49905 shows that at least in C
the correct location information is available (the second warning):

$ cat xyz.c && /build/gcc-49905/gcc/xgcc -B /build/gcc-49905/gcc -O2 -S -Wall
-Wextra -Wpedantic xyz.c
char d [4];

void f (void)
{
  __builtin_sprintf (d, "%3$i%1$i", 1, 234);
}
xyz.c: In function ‘f’:
xyz.c:5:3: warning: ISO C does not support %n$ operand number formats
[-Wformat]
   __builtin_sprintf (d, "%3$i%1$i", 1, 234);
   ^~~~~~~~~~~~~~~~~
xyz.c:5:3: warning: operand number out of range in format [-Wformat=]
xyz.c:5:27: warning: numbered argument value ‘3’ exceeds the number of provided
arguments ‘2’ [-Wformat-length=]
   __builtin_sprintf (d, "%3$i%1$i", 1, 234);
                           ^

Reply via email to