+2017-11-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/82050
+ * include/line-map.h (LINE_MAP_MAX_COLUMN_NUMBER): Move here.
+ * line-map.c (LINE_MAP_MAX_COLUMN_NUMBER): ...from here.
+ (rich_location::maybe_add_fixit): Reject fix-it hints in which
+ the start column exceeds the next column.
+
2017-11-20 Eric Gallager <egall@gwmail.gwu.edu>
PR preprocessor/81794
worked example in libcpp/location-example.txt. */
typedef unsigned int source_location;
+/* Do not track column numbers higher than this one. As a result, the
+ range of column_bits is [12, 18] (or 0 if column numbers are
+ disabled). */
+const unsigned int LINE_MAP_MAX_COLUMN_NUMBER = (1U << 12);
+
/* Do not pack ranges if locations get higher than this.
If you change this, update:
gcc.dg/plugin/location-overflow-test-*.c. */
#include "internal.h"
#include "hashtab.h"
-/* Do not track column numbers higher than this one. As a result, the
- range of column_bits is [12, 18] (or 0 if column numbers are
- disabled). */
-const unsigned int LINE_MAP_MAX_COLUMN_NUMBER = (1U << 12);
-
/* Highest possible source location encoded within an ordinary or
macro map. */
const source_location LINE_MAP_MAX_SOURCE_LOCATION = 0x70000000;
stop_supporting_fixits ();
return;
}
+ /* The columns must be in the correct order. This can fail if the
+ endpoints straddle the boundary for which the linemap can represent
+ columns (PR c/82050). */
+ if (exploc_start.column > exploc_next_loc.column)
+ {
+ stop_supporting_fixits ();
+ return;
+ }
const char *newline = strchr (new_content, '\n');
if (newline)