This changes get_alignment to assume that DW_AT_alignment refers to an
unsigned value.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
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)
{