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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh sorry, I misread your example. The second #include "header3.h" is indeed
reached. The header is skipped due to the optimization described at
https://gcc.gnu.org/onlinedocs/cpp/Once-Only-Headers.html so the second include
is skipped and the file doesn't get reopened. I suppose that's the cause:
because the file is skipped, it isn't considered "used" again.

So I think I agree with your bug report, the output should not be affected by
the optimization, and header3.h should be considered "used" again, even if it
isn't actually opened again.

Reply via email to