ubsan: obj-macho.c:503 left shift cannot be represented

* config/obj-macho.c (obj_mach_o_zerofill): Correct type of
	constant shifted left.
This commit is contained in:
Alan Modra 2020-09-02 10:10:45 +09:30
parent 251150adb1
commit 4dda287bf6
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2020-09-02 Alan Modra <amodra@gmail.com>
* config/obj-macho.c (obj_mach_o_zerofill): Correct type of
constant shifted left.
2020-09-02 Alan Modra <amodra@gmail.com>
* config/bfin-lex.l: Use an unsigned type for "value".

View File

@ -500,7 +500,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
}
size = exp.X_add_number;
size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
size &= ((valueT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
if (exp.X_add_number != size || !exp.X_unsigned)
{
as_warn (_("size (%ld) out of range, ignored"),