http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56824
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-04-10 CC| |manu at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-04-10 18:32:00 UTC --- I think the problem is the continue, which moves to the next i--: Index: diagnostic.c =================================================================== --- diagnostic.c (revision 197394) +++ diagnostic.c (working copy) @@ -664,13 +685,13 @@ diagnostic_report_diagnostic (diagnostic return false; /* This tests for #pragma diagnostic changes. */ if (context->n_classification_history > 0) { - int i; + int i = context->n_classification_history - 1; /* FIXME: Stupid search. Optimize later. */ - for (i = context->n_classification_history - 1; i >= 0; i --) + while (i >= 0) { if (linemap_location_before_p (line_table, context->classification_history[i].location, location)) @@ -686,10 +707,11 @@ diagnostic_report_diagnostic (diagnostic if (diag_class != DK_UNSPECIFIED) diagnostic->kind = diag_class; break; } } + i--; } } /* This tests if the user provided the appropriate -Werror=foo option. */ if (diag_class == DK_UNSPECIFIED but someone would need to test the patch. But it is a bug.