diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2009-08-27 22:54:28 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2009-08-27 22:54:28 +0200 |
commit | 2b3b22d35eb3243b1974de38f7cd8ae399f8de49 (patch) | |
tree | fbc1481e753d39ff76d37252ade35caddc5b102a /gcc/simplify-rtx.c | |
parent | 30ed9d3dbe146861e42fd19eb6db134c2dd263c7 (diff) | |
download | gcc-2b3b22d35eb3243b1974de38f7cd8ae399f8de49.tar.gz |
re PR rtl-optimization/40861 (ICE in simplify_subreg, at simplify-rtx.c:4981)
PR rtl-optimization/40861
* simplify-rtx.c (simplify_subreg): Do not call simplify_gen_subreg to
extract word from a multi-word subreg for negative byte positions.
testsuite/ChangeLog:
PR rtl-optimization/40861
* gcc.dg/pr40861.c: New test.
From-SVN: r151149
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index e3809a85000..0cf1dd0ce94 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -5263,13 +5263,15 @@ simplify_subreg (enum machine_mode outermode, rtx op, && GET_MODE_BITSIZE (innermode) >= (2 * GET_MODE_BITSIZE (outermode)) && CONST_INT_P (XEXP (op, 1)) && (INTVAL (XEXP (op, 1)) & (GET_MODE_BITSIZE (outermode) - 1)) == 0 + && INTVAL (XEXP (op, 1)) >= 0 && INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (innermode) && byte == subreg_lowpart_offset (outermode, innermode)) { int shifted_bytes = INTVAL (XEXP (op, 1)) / BITS_PER_UNIT; return simplify_gen_subreg (outermode, XEXP (op, 0), innermode, (WORDS_BIG_ENDIAN - ? byte - shifted_bytes : byte + shifted_bytes)); + ? byte - shifted_bytes + : byte + shifted_bytes)); } return NULL_RTX; |