SIGBUS Bus error on sparc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am starring at the following piece of code right now [*]. When I
compile and run this code on sparc64

[...]
unsigned char b[8];
[...]
v = ((unsigned long) b[0] & 0x00000000000000ff) |
(((unsigned long) b[1] << 8) & 0x000000000000ff00) |
(((unsigned long) b[2] << 16) & 0x0000000000ff0000) |
(((unsigned long) b[3] << 24) & 0x00000000ff000000) |
(((unsigned long) b[4] << 32) & 0x000000ff00000000) |
(((unsigned long) b[5] << 40) & 0x0000ff0000000000) |
(((unsigned long) b[6] << 48) & 0x00ff000000000000) |
((unsigned long) b[7] << 56);
[...]

I get a SIGBUS, Bus error (using gdb):

[...]
Testing files with 1 channels 100 times.
generating compression 0 writing copying
Program received signal SIGBUS, Bus error.
0xfffff801008590a8 in Imf_2_2::Xdr::read<Imf_2_2::StreamIO,
Imf_2_2::IStream> (in=..., v=@0x3cbb44: 0) at ./ImfXdr.h:769
769 v =  ((unsigned long) u.b[0]        & 0x00000000000000ff) |
(gdb) p u
$1 = {ul = 10959228218229391360, b = "\230\027\000\000\000\000\000"}
(gdb) p u.b[0]
$2 = 152 '\230'
(gdb) p u.b
$3 = "\230\027\000\000\000\000\000"
(gdb) p (void*)u.b
$4 = (void *) 0x7feffffe930
[...]

Using:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/sparc64-linux-gnu/5/lto-wrapper
Target: sparc64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
5.3.1-14' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++
--prefix=/usr --program-suffix=-5 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libquadmath --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-sparc64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-sparc64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-sparc64
--with-arch-directory=sparc64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
--enable-multiarch --enable-targets=all --with-long-double-128
--enable-multilib --enable-checking=release --build=sparc64-linux-gnu
--host=sparc64-linux-gnu --target=sparc64-linux-gnu
Thread model: posix
gcc version 5.3.1 20160409 (Debian 5.3.1-14)


This code compiles and run fine on amd64 (even using
-fsanitize=undefined). I fail to see what would be the issue here.

Thanks for suggestion.


[*] https://github.com/openexr/openexr/blob/master/OpenEXR/IlmImf/ImfXdr.h#L743



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux