diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-09-02 15:39:04 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-09-02 15:39:04 +0000 |
commit | a38578e1bb5456d14e97435fd02b804ea937b14e (patch) | |
tree | 5ec83c8b345f4e45753db9770b07a1f4d80d8457 /gcc/gimplify.c | |
parent | ebf178cd33b328d2d47c4845e5711edd4492b85d (diff) | |
download | gcc-a38578e1bb5456d14e97435fd02b804ea937b14e.zip gcc-a38578e1bb5456d14e97435fd02b804ea937b14e.tar.gz gcc-a38578e1bb5456d14e97435fd02b804ea937b14e.tar.bz2 |
re PR c++/23167 (internal compiler error: in create_tmp_var)
PR c++/23167
* gimplify.c (gimplify_expr): Handle TREE_ADDRESSABLE types when
generating synthetic loads from volatile lvalues.
PR c++/23167
* g++.dg/expr/volatile1.C: New test.
From-SVN: r103782
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7d76d66..c72e09e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4454,7 +4454,15 @@ 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 type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p)); - tree tmp = create_tmp_var (type, "vol"); + /* Normally, we do want to create a temporary for a + TREE_ADDRESSABLE type because such a type should not be + copied by bitwise-assignment. However, we make an + exception here, as all we are doing here is ensuring that + we read the bytes that make up the type. We use + create_tmp_var_raw because create_tmp_var will abort when + given a TREE_ADDRESSSABLE type. */ + tree tmp = create_tmp_var_raw (type, "vol"); + gimple_add_tmp_var (tmp); *expr_p = build (MODIFY_EXPR, type, tmp, *expr_p); } else |