On Wed, May 21, 2014 at 08:52:03PM +0200, Jakub Jelinek wrote: > FAIL: c-c++-common/ubsan/float-cast-overflow-10.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none (internal compiler error) > FAIL: c-c++-common/ubsan/float-cast-overflow-10.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none (test for excess errors) > FAIL: c-c++-common/ubsan/float-cast-overflow-10.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) > FAIL: c-c++-common/ubsan/float-cast-overflow-10.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) > FAIL: c-c++-common/ubsan/float-cast-overflow-7.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none (internal compiler error) > FAIL: c-c++-common/ubsan/float-cast-overflow-7.c -O2 -flto > -fno-use-linker-plugin -flto-partition=none (test for excess errors) > FAIL: c-c++-common/ubsan/float-cast-overflow-7.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) > FAIL: c-c++-common/ubsan/float-cast-overflow-7.c -O2 -flto > -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) > > The LTO ICEs on float-cast-overflow-{7,10}.c seems to be related to decimal > support: > /usr/src/gcc/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-7.c:147:1: > internal compiler error: in decimal_to_decnumber, at dfp.c:138 > 0x116b4cb decimal_to_decnumber > ../../gcc/dfp.c:138 ...
This bug is because we leave garbage in REAL_VALUE_TYPE padding bits, but then use memcmp on REAL_VALUE_TYPE objects. All other places use memset first to clear the padding bits, so I've committed this fix as obvious to trunk and 4.9 (without testcase, because I couldn't reproduce it on anything smaller than float-cast-overflow-{7,10}.c and those require further gcc patches. > The execution test FAILs for -m32 are: > ==4494==Sanitizer CHECK failed: > ../../../../../libsanitizer/ubsan/ubsan_value.cc:98 ((0 && "unexpected > floating point bit width")) != (0) (0, 0) This one can be fixed by handling 96 the same as 80 and 128, apparently even clang/llvm uses 96 on i?86 and crashes in libubsan the same way. Marek, can you please handle the LLVM bureaucracy? 2014-05-22 Jakub Jelinek <ja...@redhat.com> * tree-streamer-in.c (unpack_ts_real_cst_value_fields): Make sure all padding bits in REAL_VALUE_TYPE are cleared. --- gcc/tree-streamer-in.c.jj 2014-05-20 16:37:05.000000000 +0200 +++ gcc/tree-streamer-in.c 2014-05-22 09:40:01.300112220 +0200 @@ -168,6 +168,9 @@ unpack_ts_real_cst_value_fields (struct REAL_VALUE_TYPE r; REAL_VALUE_TYPE *rp; + /* Clear all bits of the real value type so that we can later do + bitwise comparisons to see if two values are the same. */ + memset (&r, 0, sizeof r); r.cl = (unsigned) bp_unpack_value (bp, 2); r.decimal = (unsigned) bp_unpack_value (bp, 1); r.sign = (unsigned) bp_unpack_value (bp, 1); Jakub