[5/7] Assume DW_AT_alignment is unsigned
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
This changes get_alignment to assume that DW_AT_alignment refers to an
unsigned value.
---
gdb/dwarf2/read.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
@@ -11199,16 +11199,11 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
return 0;
}
- LONGEST val = attr->constant_value (0);
- if (val < 0)
- {
- complaint (_("DW_AT_alignment value must not be negative"
- " - DIE at %s [in module %s]"),
- sect_offset_str (die->sect_off),
- objfile_name (cu->per_objfile->objfile));
- return 0;
- }
- ULONGEST align = val;
+ std::optional<ULONGEST> val = attr->unsigned_constant ();
+ if (!val.has_value ())
+ return 0;
+
+ ULONGEST align = *val;
if (align == 0)
{