+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>
PR target/14496
&& 0 != (cond0 = if_then_else_cond (SUBREG_REG (x),
&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));
- *pfalse = simplify_gen_subreg (mode, false0,
- GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
-
- return cond0;
+ if (true0 && false0)
+ {
+ *ptrue = true0;
+ *pfalse = false0;
+ return cond0;
+ }
}
/* 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>
* gcc.c-torture/execute/20040311-1.c: New test case.
--- /dev/null
+/* 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;
+}
+