public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/99446] [11 Regression] ICE in linemap_position_for_loc_and_offset, at libcpp/line-map.c:1005 since r11-6325
Date: Mon, 12 Apr 2021 13:46:51 +0000	[thread overview]
Message-ID: <bug-99446-4-cP9zNEUZzt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99446-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
The last token is a CPP_PRAGMA_EOL, and has a line number 2,
while the include file has only one line, so it is similar to an EOL position.
I guess therefore this fails to add a column?

1002      location_t r = 
1003        linemap_position_for_line_and_column (set, map, line, column);
1004      if (linemap_assert_fails (r <= set->highest_location)
1005          || linemap_assert_fails (map == linemap_lookup (set, r)))
1006        return loc;


(gdb) p tok[0]
$30 = {type = CPP_EOF, keyword = RID_MAX, flags = 64 '@', implicit_extern_c =
false, error_reported = false, 
  purged_p = false, tree_check_p = false, main_source_p = true, location =
255712, u = {tree_check_value = 0x0, 
    value = 0x0}}
(gdb) p tok[-1]
$31 = {type = CPP_PRAGMA_EOL, keyword = RID_MAX, flags = 0 '\000',
implicit_extern_c = false, error_reported = false, 
  purged_p = false, tree_check_p = false, main_source_p = false, location =
251552, u = {tree_check_value = 0x0, 
    value = 0x0}}

location_t r = 
1003        linemap_position_for_line_and_column (set, map, line, column);
(gdb) p r
$68 = 252480
(gdb) p *map
$70 = {<line_map> = {start_location = 251584}, reason = LC_LEAVE, sysp = 0
'\000', m_column_and_range_bits = 12, 
  m_range_bits = 5, to_file = 0x2ac9800 "pr99446-1.h", to_line = 2,
included_from = 238400}
(gdb) p *result
$74 = {<line_map> = {start_location = 251616}, reason = LC_LEAVE, sysp = 0
'\000', m_column_and_range_bits = 12, 
  m_range_bits = 5, to_file = 0x2b0a2d0 "pr99446.c", to_line = 2, included_from
= 0}

but line 2 does not exist in both files.

  parent reply	other threads:[~2021-04-12 13:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 10:27 [Bug preprocessor/99446] New: [11 Regression] ICE in linemap_position_for_loc_and_offset, at libcpp/line-map.c:1005 doko at debian dot org
2021-03-08  8:44 ` [Bug preprocessor/99446] " marxin at gcc dot gnu.org
2021-03-08  8:58 ` rguenth at gcc dot gnu.org
2021-03-17 11:51 ` sbergman at redhat dot com
2021-03-17 15:33 ` sbergman at redhat dot com
2021-04-08 13:02 ` rguenth at gcc dot gnu.org
2021-04-08 13:03 ` rguenth at gcc dot gnu.org
2021-04-08 13:05 ` rguenth at gcc dot gnu.org
2021-04-08 13:20 ` [Bug preprocessor/99446] [11 Regression] ICE in linemap_position_for_loc_and_offset, at libcpp/line-map.c:1005 since r11-6325 jakub at gcc dot gnu.org
2021-04-12 10:11 ` bernd.edlinger at hotmail dot de
2021-04-12 13:16 ` nathan at gcc dot gnu.org
2021-04-12 13:46 ` bernd.edlinger at hotmail dot de [this message]
2021-04-12 14:11 ` nathan at gcc dot gnu.org
2021-04-13 12:07 ` cvs-commit at gcc dot gnu.org
2021-04-13 12:08 ` nathan at gcc dot gnu.org
2021-04-18 12:44 ` bernd.edlinger at hotmail dot de

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-99446-4-cP9zNEUZzt@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: link
Be 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).