diff mbox series

[2/3] Fix min_location usage in line-map.c (PR preprocessor/90382).

Message ID a04b6fdc78eef9b96d45a39b0d92657e2ffc9937.1557820874.git.mliska@suse.cz
State New
Headers show
Series Fix linemap assertation connected to PR preprocessor/90382. | expand

Commit Message

Martin Liška May 13, 2019, 11:10 a.m. UTC
libcpp/ChangeLog:

2019-05-13  Martin Liska  <mliska@suse.cz>

	PR preprocessor/90382
	* line-map.c (first_map_in_common_1): Handle ADHOC
	locations.
---
 libcpp/line-map.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Nathan Sidwell May 14, 2019, 11:30 a.m. UTC | #1
On 5/13/19 7:10 AM, marxin wrote:
> 
> libcpp/ChangeLog:
> 
> 2019-05-13  Martin Liska  <mliska@suse.cz>
> 
> 	PR preprocessor/90382
> 	* line-map.c (first_map_in_common_1): Handle ADHOC
> 	locations.
> ---

ok
diff mbox series

Patch

diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index e1fc0e9faf4..31439f4aba3 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1251,8 +1251,13 @@  first_map_in_common_1 (struct line_maps *set,
 		       location_t *loc1)
 {
   location_t l0 = *loc0, l1 = *loc1;
-  const struct line_map *map0 = linemap_lookup (set, l0),
-    *map1 = linemap_lookup (set, l1);
+  const struct line_map *map0 = linemap_lookup (set, l0);
+  if (IS_ADHOC_LOC (l0))
+    l0 = get_location_from_adhoc_loc (set, l0);
+
+  const struct line_map *map1 = linemap_lookup (set, l1);
+  if (IS_ADHOC_LOC (l1))
+    l1 = get_location_from_adhoc_loc (set, l1);
 
   while (linemap_macro_expansion_map_p (map0)
 	 && linemap_macro_expansion_map_p (map1)