Bug 26421 - UBSAN error: gas/config/tc-arm.c:2283:28:
Summary: UBSAN error: gas/config/tc-arm.c:2283:28:
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: 2.36
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-20 12:06 UTC by Martin Liska
Modified: 2020-09-01 07:01 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2020-08-31 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liska 2020-08-20 12:06:32 UTC
The following fails when I build binutils with:
configure --build=x86_64-linux --disable-nls --disable-gdb --disable-gdbserver --disable-sim --disable-readline --disable-libdecnumber --enable-obsolete --target=arm-elf CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: arm-elf
FAIL: STM32L4XX erratum fix LDM
Executing on host: sh -c {/dev/shm/b6evfmmd/ld/../gas/as-new   -I/home/mliska/Programming/binutils/ld/testsuite/ld-arm   -o tmpdir/stm32l4xx-fix-vldm.o -EL -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 /home/mliska/Programming/binutils/ld/testsuite/ld-arm/stm32l4xx-fix-vldm.s 2>&1}  /dev/null ld.tmp (timeout = 300)
/home/mliska/Programming/binutils/gas/config/tc-arm.c:2283:28: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
Comment 1 Sourceware Commits 2020-09-01 06:58:37 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7af677524e205f3c343707d61bccd4dfd74089da

commit 7af677524e205f3c343707d61bccd4dfd74089da
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Sep 1 11:35:37 2020 +0930

    PR26420, PR26421, PR26425, PR26427 UBSAN: tc-arm.c left shifts
    
            PR 26420
            PR 26421
            PR 26425
            PR 26427
            * config/tc-arm.c (struct arm_it): Make size, size_req, cond and
            uncond_value unsigned.
            (parse_vfp_reg_list): Make setmask unsigned, vpr_str_len size_t.
            (parse_big_immediate): Cast generic_bignum elements to unsigned.
            (encode_thumb32_immediate): Shift left 0xffU.
            (double_to_single): Make sign unsigned.  Tidy.
            (move_or_literal_pool): Cast LITTLE_NUM elements to uint64_t or
            valueT.
            (vfp_or_neon_is_neon): Adjust inst.uncond_value expression.
            (md_assemble): Likewise.
            (handle_pred_state): Make cond unsigned.
            (thumb32_negate_data_op): Make variables unsigned.
            (md_apply_fix): Make value and newval unsigned, adjust uses.
Comment 2 Alan Modra 2020-09-01 07:01:28 UTC
fixed