This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[commit, spu] Fix regression (ICE) in gcc.dg/pr48335-2.c
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Apr 2014 20:55:24 +0200 (CEST)
- Subject: [commit, spu] Fix regression (ICE) in gcc.dg/pr48335-2.c
- Authentication-results: sourceware.org; auth=none
Hello,
this fixes the following regressions on spu-elf:
FAIL: gcc.dg/pr48335-2.c (internal compiler error)
FAIL: gcc.dg/pr48335-3.c (internal compiler error)
which are caused by common code calling the insv pattern with a
combination of bitoffset/bitsize that lies partially outside the
underlying target mode, causing an assertion failure in
spu_expand_insv.
The original reason for the bad offset is that the test case
actually has undefined behavior due to storing partically outside
a struct via a misaligned pointer.
Still, the compiler should not ICE, so I've fixed this similar
to what was done on s390 by just rejecting this in the insv
expander and falling back to common code.
Tested on spu-elf, committed to mainline.
Bye,
Ulrich
ChangeLog:
* config/spu/spu.md ("insv"): Fail if bitoffset+bitsize
lies outside the target mode.
Index: gcc/config/spu/spu.md
===================================================================
*** gcc/config/spu/spu.md (revision 208964)
--- gcc/config/spu/spu.md (working copy)
***************
*** 2851,2857 ****
(match_operand:SI 2 "const_int_operand" ""))
(match_operand 3 "nonmemory_operand" ""))]
""
! { spu_expand_insv(operands); DONE; })
;; Simplify a number of patterns that get generated by extv, extzv,
;; insv, and loads.
--- 2851,2863 ----
(match_operand:SI 2 "const_int_operand" ""))
(match_operand 3 "nonmemory_operand" ""))]
""
! {
! if (INTVAL (operands[1]) + INTVAL (operands[2])
! > GET_MODE_BITSIZE (GET_MODE (operands[0])))
! FAIL;
! spu_expand_insv(operands);
! DONE;
! })
;; Simplify a number of patterns that get generated by extv, extzv,
;; insv, and loads.
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com