public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "libin.dang at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/108900] New: [libcpp] cpp gives wrong line number information Date: Thu, 23 Feb 2023 08:35:27 +0000 [thread overview] Message-ID: <bug-108900-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108900 Bug ID: 108900 Summary: [libcpp] cpp gives wrong line number information Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: libin.dang at gmail dot com Target Milestone: --- Created attachment 54514 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54514&action=edit test case Reproduce: $ /home/wrsadmin/works/gcc/b0/gcc/cpp -B /home/wrsadmin/works/gcc/b0/gcc main.c -o main.i $ tail main.i header3 begins header3 begins # 1 "header2.h" 1 # 327614 "header3.h" 2 header3 ends # 4 "header1.h" 2 # 1 "header4.h" 1 # 5 "header1.h" 2 header1 ends # 2 "main.c" 2 $ cat -n header3.h | tail 327606 header3 begins 327607 header3 begins 327608 header3 begins 327609 header3 begins 327610 header3 begins 327611 header3 begins 327612 header3 begins 327613 header3 begins 327614 #include "header2.h" 327615 header3 ends The line number information for `header3 ends' is wrong. BTW, this issue is very sensitive to the input files, for example, if we add another line `header3 begins' above the `#include "header2.h"' in header3.h, we will get the correct result: $ cat -n header3.h | tail 327607 header3 begins 327608 header3 begins 327609 header3 begins 327610 header3 begins 327611 header3 begins 327612 header3 begins 327613 header3 begins 327614 header3 begins 327615 #include "header2.h" 327616 header3 ends $ tail main.i header3 begins header3 begins # 1 "header2.h" 1 # 327616 "header3.h" 2 header3 ends # 4 "header1.h" 2 # 1 "header4.h" 1 # 5 "header1.h" 2 header1 ends # 2 "main.c" 2
next reply other threads:[~2023-02-23 8:35 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-23 8:35 libin.dang at gmail dot com [this message] 2023-02-25 14:50 ` [Bug preprocessor/108900] [libcpp] cpp gives wrong line number information with a file huge number of lines libin.dang at gmail dot com 2023-05-04 10:19 ` libin.dang at gmail dot com 2023-12-28 14:10 ` libin.dang at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108900-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).