From 4dda287bf650e908271a1d36ee1fca6dece4eb16 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 2 Sep 2020 10:10:45 +0930 Subject: [PATCH] ubsan: obj-macho.c:503 left shift cannot be represented * config/obj-macho.c (obj_mach_o_zerofill): Correct type of constant shifted left. --- gas/ChangeLog | 5 +++++ gas/config/obj-macho.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index bcc56ca3b25..3d1fdb2ae0d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2020-09-02 Alan Modra + + * config/obj-macho.c (obj_mach_o_zerofill): Correct type of + constant shifted left. + 2020-09-02 Alan Modra * config/bfin-lex.l: Use an unsigned type for "value". diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 4b54a667a03..c3ce9993b3d 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -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"), -- 2.30.2