From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23997 invoked by alias); 28 Mar 2011 16:16:18 -0000 Received: (qmail 23978 invoked by uid 22791); 28 Mar 2011 16:16:17 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Mar 2011 16:15:55 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/48248] [4.5/4.6/4.7 Regression] Wrong error message location when compiling preprocessed code X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: preprocessor X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.5.3 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 28 Mar 2011 16:40:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg02906.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48248 --- Comment #4 from Jakub Jelinek 2011-03-28 16:15:52 UTC --- Ah, I can reproduce with those lines. Apparently caused by my PR41445 fix. To fix this, I think we should remember not just src_line, but also filename in print variable in c-ppoutput.c. And, either we should avoid calling do_line_change for avoid_paste resp. PREV_WHITE in scan_translation_unit if file is different, or maybe_print_line should do the if (src_line >= print.src_line && src_line < print.src_line + 8) optimization only if it is the same file. As PR41445 has been in already in 4.5 and nobody complained about e.g. # 1 "pr48248-2.C" # 1 "" # 1 "" # 1 "pr48248-2.C" # 1 "pr48248.h" 1 enum E { B }; # 2 "pr48248-2.C" 2 # 17 "pr48248-2.C" void foo () { (void) # 3 "pr48248.h" B # 20 "pr48248-2.C" ; a; } (where # 3 "pr48248.h" doesn't say that the header is being entered, just temporarily jumps to it), I'd probably prefer the latter choice, as it gives more correct locus info.