diff options
author | Richard Henderson <rth@redhat.com> | 2005-07-19 13:20:40 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-07-19 13:20:40 -0700 |
commit | af62f6f9a440d24b135f7d5023173180566a780e (patch) | |
tree | fbf02d28bdbfe2df54c4da773d527881c941eba7 /gcc/gimplify.c | |
parent | b9b8dde3026d1e54c5bb2c8fa331a7bfd84b671d (diff) | |
download | gcc-af62f6f9a440d24b135f7d5023173180566a780e.zip gcc-af62f6f9a440d24b135f7d5023173180566a780e.tar.gz gcc-af62f6f9a440d24b135f7d5023173180566a780e.tar.bz2 |
re PR tree-optimization/22278 (gcc -O2 discards cast to volatile)
PR tree-opt/22278
* gimplify.c (gimplify_expr): Use main variant type for the temp
destination for a discarded volatile read.
* tree-ssa.c (tree_ssa_useless_type_conversion_1): Don't elide
casts between non-void types that change volatility.
From-SVN: r102169
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 13cf026..3f06d7a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4411,8 +4411,9 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, { /* Historically, the compiler has treated a bare reference to a volatile lvalue as forcing a load. */ - tree tmp = create_tmp_var (TREE_TYPE (*expr_p), "vol"); - *expr_p = build (MODIFY_EXPR, TREE_TYPE (tmp), tmp, *expr_p); + tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p)); + tree tmp = create_tmp_var (type, "vol"); + *expr_p = build (MODIFY_EXPR, type, tmp, *expr_p); } else /* We can't do anything useful with a volatile reference to |