Bug 26450 - UBSAN error: opcodes/frv-ibld.c:135:52:
Summary: UBSAN error: opcodes/frv-ibld.c:135:52:
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:23 UTC by Martin Liska
Modified: 2020-08-28 14:39 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2020-08-28 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:23:44 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=frv-elf CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: frv-elf
FAIL: tls-1-dep
Executing on host: sh -c {/dev/shm/r0zogdqa/ld/../gas/as-new  -mfdpic    -o tmpdir/tls-1.o /home/mliska/Programming/binutils/ld/testsuite/ld-frv/tls-1.s 2>&1}  /dev/null dump.tmp (timeout = 300)
/home/mliska/Programming/binutils/opcodes/frv-ibld.c:135:52: runtime error: left shift of negative value -1
Comment 1 cvs-commit@gcc.gnu.org 2020-08-28 14:37:46 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit a1e60a1bdce8f555f45b5f94c059d83abf883567
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Aug 28 23:43:16 2020 +0930

    PR26449, PR26450 UBSAN: frv-ibld.c:135 left shift
    
    Eh well, I guess the code didn't quite live up to the comment.
    
            PR 26449
            PR 26450
            * cgen-ibld.in (insert_1): Use 1UL in forming mask.
            (extract_normal): Likewise.
            (insert_normal): Likewise, and move past zero length test.
            (put_insn_int_value): Handle mask for zero length, use 1UL.
            * bpf-ibld.c, * epiphany-ibld.c, * fr30-ibld.c, * frv-ibld.c,
            * ip2k-ibld.c, * iq2000-ibld.c, * lm32-ibld.c, * m32c-ibld.c,
            * m32r-ibld.c, * mep-ibld.c, * mt-ibld.c, * or1k-ibld.c,
            * xc16x-ibld.c, * xstormy16-ibld.c: Regenerate.
Comment 2 Alan Modra 2020-08-28 14:39:08 UTC
Fixed