aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-06-20 16:23:54 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-06-20 16:23:54 -0700
commitaa8dea091f83d726078a543040a5526819f21683 (patch)
treea0d0772409194eae7f488dba0cb742b1d9c93654
parent2b3aadfc7b77e551147b5250180c57c1f892e421 (diff)
downloadgcc-aa8dea091f83d726078a543040a5526819f21683.zip
gcc-aa8dea091f83d726078a543040a5526819f21683.tar.gz
gcc-aa8dea091f83d726078a543040a5526819f21683.tar.bz2
typeck.c (mark_addressable): Don't test TREE_ADDRESSABLE early.
* typeck.c (mark_addressable): Don't test TREE_ADDRESSABLE early. Call put_var_into_stack. * g++.dg/opt/asm1.C: New. From-SVN: r54862
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c7
-rw-r--r--gcc/testsuite/g++.dg/opt/asm1.C9
3 files changed, 19 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4a37ab3..8cc664e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-20 Richard Henderson <rth@redhat.com>
+
+ PR c++/6747
+ * typeck.c (mark_addressable): Don't test TREE_ADDRESSABLE early.
+ Call put_var_into_stack.
+
2002-06-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* spew.c (remove_last_token): Use ARRAY_SIZE in lieu of explicit
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 5ea8bdb..c1338d9 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4805,9 +4805,6 @@ cxx_mark_addressable (exp)
{
register tree x = exp;
- if (TREE_ADDRESSABLE (x) == 1)
- return true;
-
while (1)
switch (TREE_CODE (x))
{
@@ -4826,6 +4823,8 @@ cxx_mark_addressable (exp)
TREE_ADDRESSABLE (x) = 1; /* so compiler doesn't die later */
return true;
}
+ /* FALLTHRU */
+
case VAR_DECL:
/* Caller should not be trying to mark initialized
constant fields addressable. */
@@ -4833,6 +4832,7 @@ cxx_mark_addressable (exp)
|| DECL_IN_AGGR_P (x) == 0
|| TREE_STATIC (x)
|| DECL_EXTERNAL (x), 314);
+ /* FALLTHRU */
case CONST_DECL:
case RESULT_DECL:
@@ -4841,6 +4841,7 @@ cxx_mark_addressable (exp)
warning ("address requested for `%D', which is declared `register'",
x);
TREE_ADDRESSABLE (x) = 1;
+ put_var_into_stack (x);
return true;
case FUNCTION_DECL:
diff --git a/gcc/testsuite/g++.dg/opt/asm1.C b/gcc/testsuite/g++.dg/opt/asm1.C
new file mode 100644
index 0000000..3f932a6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/asm1.C
@@ -0,0 +1,9 @@
+// PR c++/6747
+// { dg-do compile }
+// { dg-options "-O" }
+
+void foo()
+{
+ union { double d; char c[sizeof(double)]; } tmp;
+ __asm__ ("" : "=m" (tmp.d)); // { dg-bogus "not directly addressable" }
+}