This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix PR 197
- To: gcc-patches at gcc dot gnu dot org
- Subject: C++ PATCH: Fix PR 197
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Fri, 16 Feb 2001 00:10:21 -0800
- Organization: CodeSourcery, LLC
This patch fixes PR 197 -- we were crashing on a bogus `asm'.
Tested on i686-pc-linux-gnu, applied on the mainline.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001-02-16 Mark Mitchell <mark@codesourcery.com>
* semantics.c (finish_asm_stmt): Robustify.
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.189
diff -c -p -r1.189 semantics.c
*** semantics.c 2001/01/29 18:57:22 1.189
--- semantics.c 2001/02/16 08:02:21
*************** finish_asm_stmt (cv_qualifier, string, o
*** 912,918 ****
if (!processing_template_decl)
for (t = input_operands; t; t = TREE_CHAIN (t))
! TREE_VALUE (t) = decay_conversion (TREE_VALUE (t));
r = build_stmt (ASM_STMT, cv_qualifier, string,
output_operands, input_operands,
--- 912,933 ----
if (!processing_template_decl)
for (t = input_operands; t; t = TREE_CHAIN (t))
! {
! tree converted_operand
! = decay_conversion (TREE_VALUE (t));
!
! /* If the type of the operand hasn't been determined (e.g.,
! because it involves an overloaded function), then issue an
! error message. There's no context available to resolve the
! overloading. */
! if (TREE_TYPE (converted_operand) == unknown_type_node)
! {
! cp_error ("type of asm operand `%E' could not be determined",
! TREE_VALUE (t));
! converted_operand = error_mark_node;
! }
! TREE_VALUE (t) = converted_operand;
! }
r = build_stmt (ASM_STMT, cv_qualifier, string,
output_operands, input_operands,
Index: testsuite/g++.old-deja/g++.other/asm2.C
===================================================================
RCS file: asm2.C
diff -N asm2.C
*** /dev/null Tue May 5 13:32:27 1998
--- asm2.C Fri Feb 16 00:02:22 2001
***************
*** 0 ****
--- 1,12 ----
+ // Build don't link:
+ // Origin: Mark Mitchell <mark@codesourcery.com>
+
+ struct C
+ {
+ void f ();
+ };
+
+ void C::f ()
+ {
+ asm ("" : : "m" (f)); // ERROR - type could not be determined
+ }