https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91890
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dmalcolm at redhat dot com, | |law at redhat dot com --- Comment #6 from Jeffrey A. Law <law at redhat dot com> --- This really looks like a line mapping issue to me. I think Manu is totally offbase. At the time of the diagnostic we have 3 items in context->classification_history. One for each of the ignored diagnostics and one for the pop. (gdb) p context->classification_history[2] $32 = {location = 295618, option = 0, kind = DK_POP} (gdb) p context->classification_history[1] $33 = {location = 287426, option = 419, kind = DK_IGNORED} (gdb) p context->classification_history[0] $34 = {location = 283330, option = 669, kind = DK_IGNORED} Now the diagnostic location looks like: (gdb) p location $35 = 2147483652 Now I can actually map that to a normal location by putting a breakpoint in linemap_compare_locations :-) It happens to correspond to location 267552. So as far as the compiler is concerned we're emitting a diagnostic for a location which is *before* all the pragmas AFAICT. So it's no great surprise that the pragmas have no effect on the diagnostic. We initially set the location of the strcat call to 291583 which would work beautifully. We then change the location via lower_stmt->gimple_set_block to a rather inconvenient value that's outside the scope of the pragmas and thus the pragmas have no effect.