Skip to content

Commit cdcd137

Browse files
committed
Use attribute::signed_constant in attribute::as_boolean
This changes attribute::as_boolean to use attribute::signed_constant. This is maybe overkill but lets any reasonable constant form through. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32680
1 parent 6ad5f5b commit cdcd137

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gdb/dwarf2/attribute.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,5 +326,8 @@ attribute::as_boolean () const
326326
return true;
327327
else if (form == DW_FORM_flag)
328328
return u.unsnd != 0;
329-
return constant_value (0) != 0;
329+
/* Using signed_constant here will work even for the weird case
330+
where a negative value is provided. Probably doesn't matter but
331+
also seems harmless. */
332+
return signed_constant ().value_or (0) != 0;
330333
}

0 commit comments

Comments
 (0)