aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-12-11 17:51:16 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-12-11 17:51:16 +0100
commit0ab19cbc7a46a3d3846e475a83f01717995e4bd4 (patch)
treecdb0769934f4dfd04e4caf22be45d594366f0e23 /gcc
parentcb56d8b09e0d1ad1dfdc111dd9b90b10e2164d9c (diff)
downloadgcc-0ab19cbc7a46a3d3846e475a83f01717995e4bd4.zip
gcc-0ab19cbc7a46a3d3846e475a83f01717995e4bd4.tar.gz
gcc-0ab19cbc7a46a3d3846e475a83f01717995e4bd4.tar.bz2
re PR c++/55619 (Chromium build fails with: error: memory input is not directly addressable)
PR c++/55619 * semantics.c (finish_asm_stmt): Don't call decay_conversion on input operands that can be only in memory. * g++.dg/ext/asm12.C: New test. From-SVN: r194404
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c13
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/ext/asm12.C14
4 files changed, 33 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dcb742c..baa119d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/55619
+ * semantics.c (finish_asm_stmt): Don't call decay_conversion
+ on input operands that can be only in memory.
+
2012-12-10 Eric Botcazou <ebotcazou@adacore.com>
* Make-lang.in (cp/typeck.o): Add dependency on $(PARAMS_H).
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 179c508..ad33c65 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1369,7 +1369,15 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
for (i = 0, t = input_operands; t; ++i, t = TREE_CHAIN (t))
{
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
- operand = decay_conversion (TREE_VALUE (t), tf_warning_or_error);
+ bool constraint_parsed
+ = parse_input_constraint (&constraint, i, ninputs, noutputs, 0,
+ oconstraints, &allows_mem, &allows_reg);
+ /* If the operand is going to end up in memory, don't call
+ decay_conversion. */
+ if (constraint_parsed && !allows_reg && allows_mem)
+ operand = mark_lvalue_use (TREE_VALUE (t));
+ else
+ operand = decay_conversion (TREE_VALUE (t), tf_warning_or_error);
/* If the type of the operand hasn't been determined (e.g.,
because it involves an overloaded function), then issue
@@ -1382,8 +1390,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
operand = error_mark_node;
}
- if (parse_input_constraint (&constraint, i, ninputs, noutputs, 0,
- oconstraints, &allows_mem, &allows_reg))
+ if (constraint_parsed)
{
/* If the operand is going to end up in memory,
mark it addressable. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index efdb933..c6c8bea 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2012-12-11 Jakub Jelinek <jakub@redhat.com>
+ PR c++/55619
+ * g++.dg/ext/asm12.C: New test.
+
PR tree-optimization/54570
* gcc.dg/builtin-object-size-8.c: Xfail.
* gcc.dg/builtin-object-size-13.c: New test.
diff --git a/gcc/testsuite/g++.dg/ext/asm12.C b/gcc/testsuite/g++.dg/ext/asm12.C
new file mode 100644
index 0000000..9823a8f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/asm12.C
@@ -0,0 +1,14 @@
+// PR c++/55619
+// { dg-do compile }
+
+typedef int V __attribute__ ((vector_size (4 * sizeof (int))));
+
+static const V C = { 0x201, 0, 0, 0 };
+static const int D = 0x201;
+
+void
+f ()
+{
+ __asm volatile ("" : : "m" (C));
+ __asm volatile ("" : : "m" (D));
+}