From 5c3554b7ad2c8041a923228037141f83c9e70fc6 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 1 Aug 2008 11:18:36 +0000 Subject: [PATCH] re PR middle-end/36988 (ICE in gimple_rhs_has_side_effects, at gimple.c:2369) 2008-08-01 Richard Guenther PR tree-optimization/36988 * tree-ssa-ccp.c (ccp_fold): Conversions of constants only do not matter if that doesn't change volatile qualification. * gcc.c-torture/compile/pr36988.c: New testcase. From-SVN: r138512 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr36988.c | 11 +++++++++++ gcc/tree-ssa-ccp.c | 8 +++++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr36988.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03a050b..d22df09 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-01 Richard Guenther + + PR tree-optimization/36988 + * tree-ssa-ccp.c (ccp_fold): Conversions of constants only + do not matter if that doesn't change volatile qualification. + 2008-08-01 Paolo Bonzini * configure.ac: Do not generate libada-mk. Do not subst diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd823ca..78287a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-01 Richard Guenther + + PR tree-optimization/36988 + * gcc.c-torture/compile/pr36988.c: New testcase. + 2008-08-01 Olivier Hainque * gnat.dg/raise_from_pure.ad[bs], diff --git a/gcc/testsuite/gcc.c-torture/compile/pr36988.c b/gcc/testsuite/gcc.c-torture/compile/pr36988.c new file mode 100644 index 0000000..44118d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr36988.c @@ -0,0 +1,11 @@ +typedef struct { + unsigned char mbxCommand; +} MAILBOX_t; +void lpfc_sli_brdrestart(void) +{ + volatile unsigned int word0; + MAILBOX_t *mb; + mb = (MAILBOX_t *) &word0; + mb->mbxCommand = 0x1A; + __writel((*(unsigned int *) mb)); +} diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 44b5523..b867bba 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -989,7 +989,13 @@ ccp_fold (gimple stmt) allowed places. */ if ((subcode == NOP_EXPR || subcode == CONVERT_EXPR) && ((POINTER_TYPE_P (TREE_TYPE (lhs)) - && POINTER_TYPE_P (TREE_TYPE (op0))) + && POINTER_TYPE_P (TREE_TYPE (op0)) + /* Do not allow differences in volatile qualification + as this might get us confused as to whether a + propagation destination statement is volatile + or not. See PR36988. */ + && (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (lhs))) + == TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (op0))))) || useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (op0)))) return op0; -- 2.7.4