From d7253e475b6d04445d62ae5b55c03facbd6ab87d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 27 Oct 2020 14:06:03 +0100 Subject: [PATCH] Assume subrange bounds types are unsigned if no underlying type is given. When running abidiff on test34-libjemalloc.so.2-intel-16.0.3 it would crash in array_type_def::subrange_type::get_length on the ABG_ASSERT get_upper_bound() >= get_lower_bound(). This was because that file contained a subrange upper_bound value encoded with data1 or data2 without an underlying type. In that case we assumed the value was encoded as a signed value which caused some of the upper bounds to be negative (while the lower bound, which wasn't given, was assumed to be zero). * src/abg-dwarf-reader.cc (build_subrange_type): Default is_signed to false. Signed-off-by: Mark Wielaard --- src/abg-dwarf-reader.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index aa1bb2b5..7a2b7ae0 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -14666,7 +14666,7 @@ build_subrange_type(read_context& ctxt, Dwarf_Die underlying_type_die; type_base_sptr underlying_type; /* Unless there is an underlying type which says differently. */ - bool is_signed = true; + bool is_signed = false; if (die_die_attribute(die, DW_AT_type, underlying_type_die)) underlying_type = is_type(build_ir_node_from_die(ctxt, -- 2.18.4