re PR c/6223 (internal compiler error in Wine-20020310)

PR c/6223
	* combine.c (if_then_else_cond): Use trunc_int_for_mode on nz.

	* gcc.dg/20020411-1.c: New test.

From-SVN: r52174
This commit is contained in:
Jakub Jelinek 2002-04-11 22:51:38 +02:00 committed by Jakub Jelinek
parent 6453191c99
commit 5a0dfc2e06
4 changed files with 60 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2002-04-11 Jakub Jelinek <jakub@redhat.com>
PR c/6223
* combine.c (if_then_else_cond): Use trunc_int_for_mode on nz.
2002-04-11 David O'Brien <obrien@FreeBSD.org>
* config/alpha/freebsd.h: Minor reformatting.

View File

@ -7377,7 +7377,7 @@ if_then_else_cond (x, ptrue, pfalse)
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
&& exact_log2 (nz = nonzero_bits (x, mode)) >= 0)
{
*ptrue = GEN_INT (nz), *pfalse = const0_rtx;
*ptrue = GEN_INT (trunc_int_for_mode (nz, mode)), *pfalse = const0_rtx;
return x;
}

View File

@ -1,3 +1,7 @@
2002-04-11 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20020411-1.c: New test.
2002-04-10 Jakub Jelinek <jakub@redhat.com>
PR middle-end/6247

View File

@ -0,0 +1,50 @@
/* PR c/6223
This testcase ICEd in internal check because a constant was not truncated
for its mode. */
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -march=i686" { target i?86-*-* } } */
typedef struct
{
unsigned a : 16;
unsigned b : 16;
unsigned c : 5;
unsigned d : 2;
unsigned e : 1;
unsigned f : 4;
unsigned g : 1;
unsigned h : 1;
unsigned i : 1;
unsigned j : 1;
} T;
inline void
foo (T *x, unsigned int y)
{
if ((x->j = (y >= 0x100000)))
y >>= 12;
x->a = y;
x->f = (y >> 16);
}
void __attribute__((noinline))
bar (T *x)
{
}
void
baz (unsigned int x, unsigned char y)
{
T t;
foo (&t, x - 1);
t.e = 1;
t.c = y;
t.g = 0;
t.h = 0;
t.i = (y & 0x40) != 0;
if (x == 1)
foo (&t, 1);
bar (&t);
}