OSDN Git Service

cp:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Sep 2002 14:34:02 +0000 (14:34 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Sep 2002 14:34:02 +0000 (14:34 +0000)
2002-09-16  Nathan Sidwell  <nathan@codesourcery.com>

PR c++/7015
* semantic.c (finish_asm_stmt): Fix operand/output_operands
thinko.
* typeck.c (c_expand_asm_operands): Protect from error_mark_node.
testsuite
* g++.dg/ext/asm3.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57192 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/asm3.C [new file with mode: 0644]

index da49b54..3c3fb93 100644 (file)
@@ -1,3 +1,10 @@
+2002-09-16  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/7015
+       * semantic.c (finish_asm_stmt): Fix operand/output_operands
+       thinko.
+       * typeck.c (c_expand_asm_operands): Protect from error_mark_node.
+
 2002-09-15  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/7919
index 946f715..cae2ecd 100644 (file)
@@ -929,7 +929,7 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
          tree operand;
 
          constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
-         operand = TREE_VALUE (output_operands);
+         operand = TREE_VALUE (t);
 
          if (!parse_output_constraint (&constraint,
                                        i, ninputs, noutputs,
index abf4919..f591bc6 100644 (file)
@@ -6045,9 +6045,10 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
       else
        {
          tree type = TREE_TYPE (o[i]);
-         if (CP_TYPE_CONST_P (type)
-             || (IS_AGGR_TYPE_CODE (TREE_CODE (type))
-                 && C_TYPE_FIELDS_READONLY (type)))
+         if (type != error_mark_node
+             && (CP_TYPE_CONST_P (type)
+                 || (IS_AGGR_TYPE_CODE (TREE_CODE (type))
+                     && C_TYPE_FIELDS_READONLY (type))))
            readonly_error (o[i], "modification by `asm'", 1);
        }
     }
index 48e8691..603b39d 100644 (file)
@@ -1,3 +1,7 @@
+2002-09-16  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.dg/ext/asm3.C: New test.
+
 2002-09-16  Richard Earnshaw  <rearnsha@arm.com>
 
        * objc.dg/bitfield-2.m (dg-options): Add -fsigned-char.
diff --git a/gcc/testsuite/g++.dg/ext/asm3.C b/gcc/testsuite/g++.dg/ext/asm3.C
new file mode 100644 (file)
index 0000000..699ab4c
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-do compile }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 16 Sep 2002 <nathan@codesourcery.com>
+
+// PR 7015. ICE with asms
+
+int two(int in)
+{
+  register int out;
+  __asm__ ("" : "r" (out) : "r" (in)); // { dg-error "output operand" "" }
+  return out;
+}