diff options
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/input.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/diagnostic/pr72803.C | 9 | ||||
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/line-map.c | 2 |
6 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f7f090..38b6102 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-01-07 David Malcolm <dmalcolm@redhat.com> + + PR c++/72803 + * input.c (selftest::test_accessing_ordinary_linemaps): Verify + that the transition from a max line width >= 1<<10 to narrower + lines works correctly. + 2017-01-07 Alexandre Oliva <aoliva@redhat.com> * doc/options.texi (PerFunction): New. diff --git a/gcc/input.c b/gcc/input.c index 195f72e..bbb6abb 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -1688,6 +1688,17 @@ test_accessing_ordinary_linemaps (const line_table_case &case_) linemap_line_start (line_table, 3, 2000); location_t loc_e = linemap_position_for_column (line_table, 700); + /* Transitioning back to a short line. */ + linemap_line_start (line_table, 4, 0); + location_t loc_back_to_short = linemap_position_for_column (line_table, 100); + + if (should_have_column_data_p (loc_back_to_short)) + { + /* Verify that we switched to short lines in the linemap. */ + line_map_ordinary *map = LINEMAPS_LAST_ORDINARY_MAP (line_table); + ASSERT_EQ (7, map->m_column_and_range_bits - map->m_range_bits); + } + linemap_add (line_table, LC_LEAVE, false, NULL, 0); /* Multiple files. */ @@ -1702,6 +1713,7 @@ test_accessing_ordinary_linemaps (const line_table_case &case_) assert_loceq ("foo.c", 2, 1, loc_c); assert_loceq ("foo.c", 2, 17, loc_d); assert_loceq ("foo.c", 3, 700, loc_e); + assert_loceq ("foo.c", 4, 100, loc_back_to_short); assert_loceq ("bar.c", 1, 150, loc_f); ASSERT_FALSE (is_location_from_builtin_token (loc_a)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 340ec41..1f6100b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-07 David Malcolm <dmalcolm@redhat.com> + + PR c++/72803 + * g++.dg/diagnostic/pr72803.C: New test case. + 2017-01-07 Martin Sebor <msebor@redhat.com> * gcc.dg/attr-alloc_size-3.c: Remove regex made redundant by r243461. diff --git a/gcc/testsuite/g++.dg/diagnostic/pr72803.C b/gcc/testsuite/g++.dg/diagnostic/pr72803.C new file mode 100644 index 0000000..0a9a390 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr72803.C @@ -0,0 +1,9 @@ +/* Long line, with a close brace at column 511, hence with the insertion + point for the missing semicolon at column 512. */ +class test { } +# 1 "" 1 +// The line directive appears to be necessary to trigger the ICE +// { dg-error "style of line directive is a GCC extension" "" { target *-*-* } .-2 } + +/* Verify that we get the correct line and column for the diagnostic. */ +// { dg-error "512: expected .;. after class definition" "" { target *-*-* } 3 } diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index e9055bb..082291d 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2017-01-07 David Malcolm <dmalcolm@redhat.com> + + PR c++/72803 + * line-map.c (linemap_line_start): When determining if the highest + column given out so far will fit into a proposed change to the + current map, use the effective number of column bits, rather than + the total number of column + range bits. + 2017-01-01 Jakub Jelinek <jakub@redhat.com> Update copyright years. diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 77beaff..b410c00 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -752,7 +752,7 @@ linemap_line_start (struct line_maps *set, linenum_type to_line, single line we can sometimes just increase its column_bits instead. */ if (line_delta < 0 || last_line != ORDINARY_MAP_STARTING_LINE_NUMBER (map) - || SOURCE_COLUMN (map, highest) >= (1U << column_bits) + || SOURCE_COLUMN (map, highest) >= (1U << (column_bits - range_bits)) || range_bits < map->m_range_bits) map = linemap_check_ordinary (const_cast <line_map *> |