aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2011-10-25 08:59:07 +0000
committerDodji Seketeli <dodji@redhat.com>2011-10-25 08:59:07 +0000
commit79faca9391de9fa022528bf04d996b31d22f803a (patch)
tree3118660fc98a44786e5afbba0b9d5f7fcb1aa5aa
parent958828b27ccdd6898d0b21bee7ebcad9581b4361 (diff)
Fix lookup of macro maps
* line-map.c (linemap_macro_map_lookup): Fix logic. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@180427 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libcpp/ChangeLog4
-rw-r--r--libcpp/line-map.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index d7fb84f576b..918b8af1dad 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,5 +1,9 @@
2011-10-24 Dodji Seketeli <dodji@redhat.com>
+ * line-map.c (linemap_macro_map_lookup): Fix logic.
+
+2011-10-24 Dodji Seketeli <dodji@redhat.com>
+
* include/line-map.h (linemap_expand_location): Take a line table
parameter. Update comment.
(linemap_resolve_location): Update comment.
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 7a1decc7501..23a0347cb5f 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -588,14 +588,14 @@ linemap_macro_map_lookup (struct line_maps *set, source_location line)
mn = 0;
}
- do
+ while (mn < mx)
{
md = (mx + mn) / 2;
if (MAP_START_LOCATION (LINEMAPS_MACRO_MAP_AT (set, md)) > line)
- mn = md;
+ mn = md + 1;
else
mx = md;
- } while (mx - mn > 1);
+ }
LINEMAPS_MACRO_CACHE (set) = mx;
result = LINEMAPS_MACRO_MAP_AT (set, LINEMAPS_MACRO_CACHE (set));