OSDN Git Service

Fix lookup of macro maps
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Oct 2011 08:59:07 +0000 (08:59 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Oct 2011 08:59:07 +0000 (08:59 +0000)
* line-map.c (linemap_macro_map_lookup): Fix logic.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180427 138bc75d-0d04-0410-961f-82ee72b054a4

libcpp/ChangeLog
libcpp/line-map.c

index d7fb84f..918b8af 100644 (file)
@@ -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.
index 7a1decc..23a0347 100644 (file)
@@ -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));