re PR c++/23167 (internal compiler error: in create_tmp_var)
authorMark Mitchell <mark@codesourcery.com>
Fri, 2 Sep 2005 15:39:04 +0000 (15:39 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 2 Sep 2005 15:39:04 +0000 (15:39 +0000)
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

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/volatile1.C [new file with mode: 0644]

index a89a70fcada24069aa59169cf5ea002836aaff8b..c7dccbd65b26504a04139de7dbb7db13611f9a3a 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-31  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/23167
+       * gimplify.c (gimplify_expr): Handle TREE_ADDRESSABLE types when
+       generating synthetic loads from volatile lvalues.
+
 005-09-02  Nick Clifton  <nickc@redhat.com>
 
        * config/stormy16/stormy16-lib2.c (__popcounthi2, __parityhi2,
index 7d76d66c507d0b24c3a31f83b3e497fa0e3c26d8..c72e09e362d26dd71a63df24f009cc6b2fe1fb2c 100644 (file)
@@ -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
index cfe394139ccf23eb6718d6f75c0f62e470d1e7b9..6da1500d0b75666cb02e5299fbf905a37ad83dbc 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-31  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/23167
+       * g++.dg/expr/volatile1.C: New test.
+
 2005-09-02  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/23547
diff --git a/gcc/testsuite/g++.dg/expr/volatile1.C b/gcc/testsuite/g++.dg/expr/volatile1.C
new file mode 100644 (file)
index 0000000..712c9e0
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/23167
+
+struct dom
+{
+  static int tostr();
+  void eval_old() volatile{tostr();}
+  ~dom() throw();
+};
+