https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87757
Aldy Hernandez <aldyh at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-10-30 Ever confirmed|0 |1 --- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- (In reply to David Malcolm from comment #4) > Aldy: do you remember why the arguments need to have the same location as > the call itself? > > The first case works because during gimplify_arg it's wrapped in a NOP_EXPR > which is casting from char[] to char *, and it's this NOP_EXPR which gets > its location modified. > > The second case doesn't have the NOP_EXPR. This looks like an oversight on my part. In the original patch you mention, there was a now defunct bit that seems suspicious and my shed light on the problem: + /* FIXME diagnostics: This should be the location of the argument, + not the FNDECL. E.g., for an old-style declaration + + int f10(v) { blah; } + + We should use the location of the V, not the F10. + Unfortunately, the V is an IDENTIFIER_NODE which has no + location. In the future we need locations for c_arg_info + entries. + + See gcc.dg/Wshadow-3.c for an example of this problem. */ So maybe I was assuming that the problematic line was also dealing with an IDENTIFIER_NODE which had no place to put a location? Either way, it looks like some sort of oversight. Confirmed, BTW.