stmt.c (expand_asm_operands): Check whether force_const_mem succeeded.
authorRichard Sandiford <rsandifo@redhat.com>
Sat, 29 Nov 2003 18:54:43 +0000 (18:54 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 29 Nov 2003 18:54:43 +0000 (18:54 +0000)
* stmt.c (expand_asm_operands): Check whether force_const_mem
succeeded.

testsuite/
* gcc.dg/tls/asm-1.C: New test.

From-SVN: r74035

gcc/ChangeLog
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tls/asm-1.c [new file with mode: 0644]

index b980ee6..2fc72f9 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-29  Richard Sandiford  <rsandifo@redhat.com>
+
+       * stmt.c (expand_asm_operands): Check whether force_const_mem
+       succeeded.
+
 2003-11-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * config/gnu.h (HURD_TARGET_OS_CPP_BUILTINS): New.
index 34e9457..a7c9104 100644 (file)
@@ -1712,13 +1712,16 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
 
              if (CONSTANT_P (op))
                {
-                 op = force_const_mem (TYPE_MODE (type), op);
-                 op = validize_mem (op);
+                 rtx mem = force_const_mem (TYPE_MODE (type), op);
+                 if (mem)
+                   op = validize_mem (mem);
+                 else
+                   op = force_reg (TYPE_MODE (type), op);
                }
-             else if (GET_CODE (op) == REG
-                      || GET_CODE (op) == SUBREG
-                      || GET_CODE (op) == ADDRESSOF
-                      || GET_CODE (op) == CONCAT)
+             if (GET_CODE (op) == REG
+                 || GET_CODE (op) == SUBREG
+                 || GET_CODE (op) == ADDRESSOF
+                 || GET_CODE (op) == CONCAT)
                {
                  tree qual_type = build_qualified_type (type,
                                                         (TYPE_QUALS (type)
index 77938bd..6ef9814 100644 (file)
@@ -1,3 +1,7 @@
+2003-11-29  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.dg/tls/asm-1.C: New test.
+
 2003-11-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * testsuite/gcc.dg/cpp/assert4.c: Update.
diff --git a/gcc/testsuite/gcc.dg/tls/asm-1.c b/gcc/testsuite/gcc.dg/tls/asm-1.c
new file mode 100644 (file)
index 0000000..68c49f6
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-options "-Werror" } */
+__thread int i;
+
+int foo ()
+{
+  asm volatile ("" :: "m" (&i));       /* { dg-error "lvalue" } */
+}