This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to tsubst_expr/ASM_STMT


This patch fixes a regression from 2.95; we were losing the ASM_INPUT_P
flag when instantiating a template, causing us to complain about asm
syntax.

Tested i686-pc-linux-gnu, applied trunk.  I'll apply it to the 3.1 branch
after 3.1.0 goes out.

2002-05-09  Jason Merrill  <jason@redhat.com>

	* pt.c (tsubst_expr) [ASM_STMT]: Copy ASM_INPUT_P.

*** pt.c.~1~	Wed May  8 00:22:41 2002
--- pt.c	Thu May  9 16:00:18 2002
*************** tsubst_expr (t, args, complain, in_decl)
*** 7541,7552 ****
  
      case ASM_STMT:
        prep_stmt (t);
!       finish_asm_stmt (ASM_CV_QUAL (t),
! 		       tsubst_expr (ASM_STRING (t), args, complain, in_decl),
! 		       tsubst_expr (ASM_OUTPUTS (t), args, complain, in_decl),
! 		       tsubst_expr (ASM_INPUTS (t), args, complain, in_decl), 
! 		       tsubst_expr (ASM_CLOBBERS (t), args, complain,
! 				    in_decl));
        break;
  
      case TRY_BLOCK:
--- 7541,7553 ----
  
      case ASM_STMT:
        prep_stmt (t);
!       tmp = finish_asm_stmt
! 	(ASM_CV_QUAL (t),
! 	 tsubst_expr (ASM_STRING (t), args, complain, in_decl),
! 	 tsubst_expr (ASM_OUTPUTS (t), args, complain, in_decl),
! 	 tsubst_expr (ASM_INPUTS (t), args, complain, in_decl), 
! 	 tsubst_expr (ASM_CLOBBERS (t), args, complain, in_decl));
!       ASM_INPUT_P (tmp) = ASM_INPUT_P (t);
        break;
  
      case TRY_BLOCK:
// Bug: in a template, we forgot that this was a simple asm, and decided
// that %edi was a malformed operand specifier.

template <class T> class  I {
public:
 void f() { asm ("# mov %edi, %esi" ); }
};

main () {
  I<int> x;
  x.f();
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]