Commit bbe708a3 by Ulrich Weigand Committed by Ulrich Weigand

combine.c (if_then_else_cond): Check for NULL return value of simplify_gen_subreg.

ChangeLog:

	* combine.c (if_then_else_cond): Check for NULL return value of
	simplify_gen_subreg.

testsuite/ChangeLog:

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

From-SVN: r79347
parent 0e808055
2004-03-11 Ulrich Weigand <uweigand@de.ibm.com>
* combine.c (if_then_else_cond): Check for NULL return value of
simplify_gen_subreg.
2004-03-11 Richard Sandiford <rsandifo@redhat.com> 2004-03-11 Richard Sandiford <rsandifo@redhat.com>
PR target/14496 PR target/14496
......
...@@ -7378,12 +7378,16 @@ if_then_else_cond (rtx x, rtx *ptrue, rtx *pfalse) ...@@ -7378,12 +7378,16 @@ if_then_else_cond (rtx x, rtx *ptrue, rtx *pfalse)
&& 0 != (cond0 = if_then_else_cond (SUBREG_REG (x), && 0 != (cond0 = if_then_else_cond (SUBREG_REG (x),
&true0, &false0))) &true0, &false0)))
{ {
*ptrue = simplify_gen_subreg (mode, true0, true0 = simplify_gen_subreg (mode, true0,
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
false0 = simplify_gen_subreg (mode, false0,
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x)); GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
*pfalse = simplify_gen_subreg (mode, false0, if (true0 && false0)
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x)); {
*ptrue = true0;
return cond0; *pfalse = false0;
return cond0;
}
} }
/* If X is a constant, this isn't special and will cause confusions /* If X is a constant, this isn't special and will cause confusions
......
2004-03-11 Ulrich Weigand <uweigand@de.ibm.com>
* gcc.dg/20040310-1.c: New test.
2004-03-11 Roger Sayle <roger@eyesopen.com> 2004-03-11 Roger Sayle <roger@eyesopen.com>
* gcc.c-torture/execute/20040311-1.c: New test case. * gcc.c-torture/execute/20040311-1.c: New test case.
......
/* This caused cc1 to segfault on s390x-ibm-linux
due to a bug in if_then_else_cond (combine.c). */
/* { dg-do compile } */
/* { dg-options "-O1" } */
extern void use (unsigned int x);
int main (void)
{
union
{
unsigned int x;
unsigned long pad;
} A;
struct
{
unsigned int x : 1;
} B;
A.x = 1;
B.x = 1;
A.x /= B.x;
use (A.x);
A.x = 1;
B.x = 1;
B.x /= A.x;
use (B.x);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment