This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/66415] [6 Regression] ice in location_column_from_byte_offset
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Sep 2015 14:52:41 +0000
- Subject: [Bug c/66415] [6 Regression] ice in location_column_from_byte_offset
- Auto-submitted: auto-generated
- References: <bug-66415-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66415
--- Comment #10 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
Author: manu
Date: Mon Sep 21 14:52:09 2015
New Revision: 227975
URL: https://gcc.gnu.org/viewcvs?rev=227975&root=gcc&view=rev
Log:
Handle lines encoded into several maps in linemap_position_for_loc_and_offset
linemap_position_for_loc_and_offset() tries to generate a location_t
encoding a column offset from the current location, for example, point
to a certain character inside a string. This is trivial to do when the
new location "fits within" the map of the original location. However,
it may happen that the (long) line corresponding to the original
location is encoded in several maps, thus the new location should
actually be encoded in a subsequent map from the original location.
This patch detects this case and adjusts the map correspondingly.
(This shows that the line-map representation is quite wasteful in this
case, because line-maps always start at column 0. That is, map[0]
highest location may encode up to line 8 column 80, then
map[1]->start_location starts encoding at line 8 column 0. Thus, there
are two location_t values that point to the same source location.)
libcpp/ChangeLog:
2015-09-21 Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
PR c/66415
* line-map.c (linemap_position_for_loc_and_offset): Handle the
case of long lines encoded in multiple maps.
gcc/testsuite/ChangeLog:
2015-09-21 Manuel LÃpez-IbÃÃez <manu@gcc.gnu.org>
PR c/66415
* gcc.dg/cpp/pr66415-1.c: Test column number.
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/cpp/pr66415-1.c
trunk/libcpp/ChangeLog
trunk/libcpp/line-map.c