Bug 26457 - UBSAN error: bfd/som.c:1794:5:
Summary: UBSAN error: bfd/som.c:1794:5:
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:27 UTC by Martin Liska
Modified: 2020-08-31 11: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:27:52 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=hppa-hp-hpux10 CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: hppa-hp-hpux10
FAIL: Test for alignment bug when switching subspaces (part1)
Executing on host: sh -c {../as-new   /home/mliska/Programming/binutils/gas/testsuite/gas/hppa/unsorted/align4.s 2>&1}  /dev/null gas.out (timeout = 300)
/home/mliska/Programming/binutils/bfd/som.c:1794:5: runtime error: left shift of 127 by 25 places cannot be represented in type 'int'
Comment 1 Sourceware Commits 2020-08-31 10:59:22 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit a148a448ec071faaf0af4d5eaad6178eded35477
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Aug 31 10:03:59 2020 +0930

    PR26457 UBSAN: som.c:1794 left shift cannot be represented
    
            PR 26457
            * som/aout.h (SOM_SUBSPACE_ACCESS_CONTROL_BITS_MASK): Make unsigned.
            (SOM_SUBSPACE_MEMORY_RESIDENT, SOM_SUBSPACE_DUP_COMMON)
            (SOM_SUBSPACE_IS_COMMON, SOM_SUBSPACE_IS_LOADABLE)
            (SOM_SUBSPACE_QUADRANT_MASK, SOM_SUBSPACE_INITIALLY_FROZEN)
            (SOM_SUBSPACE_IS_FIRST, SOM_SUBSPACE_CODE_ONLY)
            (SOM_SUBSPACE_SORT_KEY_MASK, SOM_SUBSPACE_REPLICATE_INIT)
            (SOM_SUBSPACE_CONTINUATION, SOM_SUBSPACE_IS_TSPECIFIC)
            (SOM_SUBSPACE_IS_COMDAT): Likewise.
Comment 2 Alan Modra 2020-08-31 11:01:58 UTC
Fixed