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]: Fix 7015


Hi,
I've installed this obvious patch for 7015. Part of which was suggested
by the reporter, and the other part I found.

built & tested on i686-pc-linux-gnu.

nathan
--
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org

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.

Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.276
diff -c -3 -p -r1.276 semantics.c
*** cp/semantics.c	14 Sep 2002 12:07:44 -0000	1.276
--- cp/semantics.c	16 Sep 2002 09:03:21 -0000
*************** finish_asm_stmt (cv_qualifier, string, o
*** 929,935 ****
  	  tree operand;
  
  	  constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
! 	  operand = TREE_VALUE (output_operands);
  
  	  if (!parse_output_constraint (&constraint,
  					i, ninputs, noutputs,
--- 929,935 ----
  	  tree operand;
  
  	  constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
! 	  operand = TREE_VALUE (t);
  
  	  if (!parse_output_constraint (&constraint,
  					i, ninputs, noutputs,
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.427
diff -c -3 -p -r1.427 typeck.c
*** cp/typeck.c	14 Sep 2002 12:07:44 -0000	1.427
--- cp/typeck.c	16 Sep 2002 09:03:22 -0000
*************** c_expand_asm_operands (string, outputs, 
*** 6045,6053 ****
        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)))
  	    readonly_error (o[i], "modification by `asm'", 1);
  	}
      }
--- 6045,6054 ----
        else
  	{
  	  tree type = TREE_TYPE (o[i]);
! 	  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);
  	}
      }
// { 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;
}

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