From 6228e2790a72b3335e12d7604ba60f0d3fa1c880 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 2 Sep 2020 10:24:31 +0930 Subject: [PATCH] ubsan: tc-sparc.c:1146 left shift cannot be represented * config/tc-sparc.c (in_signed_range): Use an unsigned type for sign mask. --- gas/ChangeLog | 5 +++++ gas/config/tc-sparc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index b6bc2099cd7..d6b58b48527 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2020-09-02 Alan Modra + + * config/tc-sparc.c (in_signed_range): Use an unsigned type for + sign mask. + 2020-09-02 Alan Modra * config/tc-nios2.c (md_apply_fix): Avoid too large shift. diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index d48112ec0af..d728d26531f 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -1143,7 +1143,7 @@ in_signed_range (bfd_signed_vma val, bfd_signed_vma max) 0xffffffff is always considered -1 on sparc32. */ if (sparc_arch_size == 32) { - bfd_signed_vma sign = (bfd_signed_vma) 1 << 31; + bfd_vma sign = (bfd_vma) 1 << 31; val = ((val & U0xffffffff) ^ sign) - sign; } if (val > max) -- 2.30.2