From: Nathan Sidwell Date: Mon, 16 Sep 2002 14:34:02 +0000 (+0000) Subject: re PR c++/7015 (certain __asm__ constructs rejected) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28c56d256992d5d330ebec07b1e939924b8d1086;p=gcc.git re PR c++/7015 (certain __asm__ constructs rejected) cp: 2002-09-16 Nathan Sidwell 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. From-SVN: r57192 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da49b547f69..3c3fb937d88 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2002-09-16 Nathan Sidwell + + 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 PR c++/7919 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 946f7156d19..cae2ecdb972 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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, diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index abf4919e5fb..f591bc6e911 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48e86910cde..603b39d080a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-09-16 Nathan Sidwell + + * g++.dg/ext/asm3.C: New test. + 2002-09-16 Richard Earnshaw * 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 index 00000000000..699ab4c8252 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/asm3.C @@ -0,0 +1,13 @@ +// { dg-do compile } + +// Copyright (C) 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 16 Sep 2002 + +// PR 7015. ICE with asms + +int two(int in) +{ + register int out; + __asm__ ("" : "r" (out) : "r" (in)); // { dg-error "output operand" "" } + return out; +}