| 1 |
// { dg-do compile } |
| 2 |
// { dg-additional-options "-fno-exceptions --param=logical-op-non-short-circuit=0" } |
| 3 |
|
| 4 |
typedef unsigned int location_t; |
| 5 |
const location_t MAX_LOCATION_T = 0x7FFFFFFF; |
| 6 |
struct line_maps { |
| 7 |
unsigned int info_ordinary; |
| 8 |
location_t *maps; |
| 9 |
unsigned int used; |
| 10 |
location_t *data; |
| 11 |
}; |
| 12 |
inline location_t LINEMAPS_MACRO_LOWEST_LOCATION(const line_maps *set) { |
| 13 |
return set->used |
| 14 |
? set->maps[set->used - 1] |
| 15 |
: MAX_LOCATION_T + 1; |
| 16 |
} |
| 17 |
const location_t *linemap_lookup(const line_maps *set, location_t line) { |
| 18 |
int mn = set->info_ordinary; |
| 19 |
if (mn >= 0) |
| 20 |
if ((unsigned int)mn < set->used) |
| 21 |
return &set->maps[0]; |
| 22 |
__builtin_unreachable(); |
| 23 |
} |
| 24 |
bool linemap_location_from_macro_expansion_p(const class line_maps *set, |
| 25 |
location_t location) { |
| 26 |
if (location > MAX_LOCATION_T) |
| 27 |
location = set->data[location & MAX_LOCATION_T]; |
| 28 |
return location >= LINEMAPS_MACRO_LOWEST_LOCATION(set); |
| 29 |
} |
| 30 |
void first_map_in_common_1(line_maps *set, location_t *loc0, |
| 31 |
location_t *loc1) { |
| 32 |
linemap_lookup(set, 0); |
| 33 |
__builtin_unreachable(); |
| 34 |
} |
| 35 |
int linemap_compare_locations(line_maps *set, location_t pre, location_t post) { |
| 36 |
bool pre_virtual_p; |
| 37 |
location_t l0 = pre, l1 = post; |
| 38 |
if (l0 > MAX_LOCATION_T) |
| 39 |
l0 = set->data[l0 & MAX_LOCATION_T]; |
| 40 |
if (l1 > MAX_LOCATION_T) |
| 41 |
l1 = set->data[l1 & MAX_LOCATION_T];; |
| 42 |
if (l0 == l1) |
| 43 |
return 0; |
| 44 |
if ((pre_virtual_p = linemap_location_from_macro_expansion_p(set, l0))) |
| 45 |
l0 = set->data[l0 & MAX_LOCATION_T]; |
| 46 |
if (linemap_location_from_macro_expansion_p(set, l1)) |
| 47 |
l1 = set->data[l1 & MAX_LOCATION_T]; |
| 48 |
if (l0 == l1) |
| 49 |
if (pre_virtual_p) |
| 50 |
first_map_in_common_1(set, &l0, &l1); |
| 51 |
if (l0 > MAX_LOCATION_T) |
| 52 |
if (l1 > MAX_LOCATION_T) |
| 53 |
l1 = set->data[l1 & MAX_LOCATION_T]; |
| 54 |
return l1 - l0; |
| 55 |
} |