re PR debug/46893 (ICE: in trunc_int_for_mode, at explow.c:56 with -O -g)

PR debug/46893
	* cfgexpand.c (expand_debug_expr): If GET_MODE (op0) is VOIDmode,
	use TYPE_MODE (TREE_TYPE (tem)) instead of mode1.

	* gcc.dg/pr46893.c: New test.

From-SVN: r167949
This commit is contained in:
Jakub Jelinek 2010-12-16 18:14:30 +01:00 committed by Jakub Jelinek
parent 8f2cbdcac7
commit 9712cba006
4 changed files with 27 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2010-12-16 Jakub Jelinek <jakub@redhat.com>
PR debug/46893
* cfgexpand.c (expand_debug_expr): If GET_MODE (op0) is VOIDmode,
use TYPE_MODE (TREE_TYPE (tem)) instead of mode1.
2010-12-16 Chung-Lin Tang <cltang@codesourcery.com>
PR target/46883

View file

@ -2703,7 +2703,7 @@ expand_debug_expr (tree exp)
enum machine_mode opmode = GET_MODE (op0);
if (opmode == VOIDmode)
opmode = mode1;
opmode = TYPE_MODE (TREE_TYPE (tem));
/* This condition may hold if we're expanding the address
right past the end of an array that turned out not to
@ -2724,7 +2724,8 @@ expand_debug_expr (tree exp)
? SIGN_EXTRACT
: ZERO_EXTRACT, mode,
GET_MODE (op0) != VOIDmode
? GET_MODE (op0) : mode1,
? GET_MODE (op0)
: TYPE_MODE (TREE_TYPE (tem)),
op0, GEN_INT (bitsize), GEN_INT (bitpos));
}

View file

@ -1,3 +1,8 @@
2010-12-16 Jakub Jelinek <jakub@redhat.com>
PR debug/46893
* gcc.dg/pr46893.c: New test.
2010-12-16 H.J. Lu <hongjiu.lu@intel.com>
PR lto/46976

View file

@ -0,0 +1,13 @@
/* PR debug/46893 */
/* { dg-do compile } */
/* { dg-options "-O -g" } */
void
foo (void)
{
union { unsigned long long l; double d; } u = { 0x7ff0000000000000ULL };
double v = 0, w = -u.d;
if (w)
w = v;
}