Allan reported this, but we've had people report the same issue to us. Manuel supplied the patch, but couldn't bootstrap and regtest it. He did have a question of whether this was the "correct" fix:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57653#c18 ...so I thought I could at least bootstrap and regtest the patch, which I have done on trunk, 4.9 and the 4.8 branches. They all passed with not regressions. I can also confirm that the patch fixes the error Allan and we are seeing. Although, I will note that I needed a fairly new distro installed to see this. With an older distro (glibc?), the error doesn't recreate. Can someone please review Manuel's patch for correctness? If it's ok, Manuel can you commit this to trunk and the branches? Or do you want me to commit it for you? I will note that I attempted to create a testsuite test case for this, but dg-error and dg-message both seem to only allow you to match the error output after the line #/row #, so it seems impossible to test for this. If someone has any suggestions on how a test case can be written, I'm willing to try it. Peter PR c/57653 * c-family/c-opts.c: Index: gcc/c-family/c-opts.c =================================================================== --- gcc/c-family/c-opts.c (revision 209715) +++ gcc/c-family/c-opts.c (working copy) @@ -1357,6 +1357,10 @@ static void push_command_line_include (void) { + // This can happen if disabled by -imacros for example. + if (include_cursor > deferred_count) + return; + if (!done_preinclude) { done_preinclude = true;