diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-08 15:16:12 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-08 15:16:12 +0000 |
commit | 6e84ccad92234cc5d4c33271e570337b7c5153fd (patch) | |
tree | fe37332799f04ee9e13b2ad6fdc2167b0d47d1a8 /libcpp/line-map.c | |
parent | 3b43af65846b98a360a760066c1a038f5451dcdf (diff) | |
download | gcc-6e84ccad92234cc5d4c33271e570337b7c5153fd.tar.gz |
PR c/66415
* c-format.c (location_from_offset): Return LOC if LINE is null.
* line-map.c (linemap_position_for_loc_and_offset): Remove
linemap_assert_fails; reverse conditions.
* gcc.dg/cpp/pr66415-1.c: New test.
* gcc.dg/cpp/pr66415-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224236 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/line-map.c')
-rw-r--r-- | libcpp/line-map.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 972f66cb90b..d58cad23fdb 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -688,15 +688,17 @@ linemap_position_for_loc_and_offset (struct line_maps *set, /* We find the real location and shift it. */ loc = linemap_resolve_location (set, loc, LRK_SPELLING_LOCATION, &map); /* The new location (loc + offset) should be higher than the first - location encoded by MAP. */ - if (linemap_assert_fails (MAP_START_LOCATION (map) < loc + offset)) + location encoded by MAP. + FIXME: We used to linemap_assert_fails here and in the if below, + but that led to PR66415. So give up for now. */ + if ((MAP_START_LOCATION (map) >= loc + offset)) return loc; /* If MAP is not the last line map of its set, then the new location (loc + offset) should be less than the first location encoded by the next line map of the set. */ if (map != LINEMAPS_LAST_ORDINARY_MAP (set)) - if (linemap_assert_fails (loc + offset < MAP_START_LOCATION (&map[1]))) + if ((loc + offset >= MAP_START_LOCATION (&map[1]))) return loc; offset += SOURCE_COLUMN (map, loc); |