diff options
author | Tom Tromey <tromey@adacore.com> | 2025-03-10 10:03:17 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-04-24 13:25:08 -0600 |
commit | b7b4a8ebb6c36f9aedea200095c850c3347eb42b (patch) | |
tree | 4b70543fcbceff07befb9532c6945343726c3bb5 | |
parent | 3d0e5b99929b0192abfd8dc12b37ac6eaf7fdfd1 (diff) | |
download | binutils-b7b4a8ebb6c36f9aedea200095c850c3347eb42b.zip binutils-b7b4a8ebb6c36f9aedea200095c850c3347eb42b.tar.gz binutils-b7b4a8ebb6c36f9aedea200095c850c3347eb42b.tar.bz2 |
Use attribute::signed_constant for fixed-point scale
This changes the DWARF reader to use attribute::signed_constant for
DW_AT_binary_scale and DW_AT_decimal_scale. (FWIW these were the
attributes that first lead me to find this problem.)
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32680
-rw-r--r-- | gdb/dwarf2/read.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 8da0b38..5751e76 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -13398,14 +13398,14 @@ finish_fixed_point_type (struct type *type, const char *suffix, } else if (attr->name == DW_AT_binary_scale) { - LONGEST scale_exp = attr->constant_value (0); + LONGEST scale_exp = attr->signed_constant ().value_or (0); gdb_mpz &num_or_denom = scale_exp > 0 ? scale_num : scale_denom; num_or_denom <<= std::abs (scale_exp); } else if (attr->name == DW_AT_decimal_scale) { - LONGEST scale_exp = attr->constant_value (0); + LONGEST scale_exp = attr->signed_constant ().value_or (0); gdb_mpz &num_or_denom = scale_exp > 0 ? scale_num : scale_denom; num_or_denom = gdb_mpz::pow (10, std::abs (scale_exp)); |