summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-08-01 11:18:36 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-08-01 11:18:36 +0000
commit5c3554b7ad2c8041a923228037141f83c9e70fc6 (patch)
tree86b09e89c117c517dac0ea8fa7d515551511a1fe /gcc/tree-ssa-ccp.c
parent585df50b0c63b895742726b556732faac623fa35 (diff)
downloadgcc-5c3554b7ad2c8041a923228037141f83c9e70fc6.tar.gz
re PR middle-end/36988 (ICE in gimple_rhs_has_side_effects, at gimple.c:2369)
2008-08-01 Richard Guenther <rguenther@suse.de> 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
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 44b5523263d..b867bba08d5 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;