This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix LTO decimal ICE
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 22 May 2014 10:06:36 +0200
- Subject: [PATCH] Fix LTO decimal ICE
- Authentication-results: sourceware.org; auth=none
- References: <20140514113839 dot GE10386 at tucnak dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1405141727440 dot 16785 at digraph dot polyomino dot org dot uk> <20140515190929 dot GQ10386 at tucnak dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1405152124440 dot 911 at digraph dot polyomino dot org dot uk> <20140516073654 dot GS10386 at tucnak dot redhat dot com> <20140520203343 dot GF4561 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1405202147260 dot 5599 at digraph dot polyomino dot org dot uk> <20140521125100 dot GB5135 at redhat dot com> <20140521144614 dot GT10386 at tucnak dot redhat dot com> <20140521185203 dot GV10386 at tucnak dot redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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 <jakub@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