[Bug preprocessor/79106] wrong source line printed in diagnostics for a translation unit

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 17 01:50:00 GMT 2017


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-01-17
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> IMNSHO the GCC behavior is the right thing to do, that is how the source
> looks like.  If the preprocessed file has been hand-edited, it is just a
> user bug.

I disagree.  Suppose the translation unit comes from a header from version X of
software installed on the system it was obtained on by a user (say a bug
submitter).  Suppose version Y of the same software is installed on the system
where the translation unit is being compiled (say by whoever is debugging it
for the user).  Then even when it isn't edited, diagnostics that point into the
header included in the translation unit will print potentially unrelated lines
from the header where the translation unit is being compiled.  That's just
wrong.  GCC should print the code from the translation unit, not some unrelated
files that just happen to have the same name as those referenced in it.


More information about the Gcc-bugs mailing list