// 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 }
+/* Verify that we get the best line and column for the diagnostic.
+ 512 is not representable in the line-maps created for this test. */
+// { dg-error "511: expected .;. after class definition" "" { target *-*-* } 3 }
(loc + offset) should be less than the first location encoded by
the next line map of the set. Otherwise, we try to encode the
location in the next map. */
- while (map != LINEMAPS_LAST_ORDINARY_MAP (set)
- && (loc + (column_offset << map->m_range_bits)
- >= MAP_START_LOCATION (&map[1])))
- {
- map = &map[1];
- /* If the next map starts in a higher line, we cannot encode the
- location there. */
- if (line < ORDINARY_MAP_STARTING_LINE_NUMBER (map))
- return loc;
- }
+ for (; map != LINEMAPS_LAST_ORDINARY_MAP (set)
+ && (loc + (column << map->m_range_bits)
+ >= MAP_START_LOCATION (map + 1)); map++)
+ /* If the next map is a different file, or starts in a higher line, we
+ cannot encode the location there. */
+ if ((map + 1)->reason != LC_RENAME
+ || line < ORDINARY_MAP_STARTING_LINE_NUMBER (map + 1)
+ || 0 != strcmp (LINEMAP_FILE (map + 1), LINEMAP_FILE (map)))
+ return loc;
column += column_offset;