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]

PATCH: PR 22000


This patch fixes PR 22000, a case where we discard a read from a
volatile memory location.

RTH says that there may be more clever ways to fix this, but that this
approach is safe enough.  Tested on x86_64-unknown-linux-gnu, applied
on the 4.0 branch.  I will commit to mainline after testing there as
well.  

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-06-23  Mark Mitchell  <mark@codesourcery.com>

	PR 22000
	* tree-ssa-operands.c (get_expr_operands): Check the volatility of
	the FIELD_DECL and set s_ann->has_volatile_ops accordingly.

Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.63
diff -c -5 -p -r2.63 tree-ssa-operands.c
*** tree-ssa-operands.c	23 Feb 2005 05:08:24 -0000	2.63
--- tree-ssa-operands.c	23 Jun 2005 16:04:17 -0000
*************** get_expr_operands (tree stmt, tree *expr
*** 1131,1142 ****
        if (SSA_VAR_P (TREE_OPERAND (expr, 0)))
  	add_stmt_operand (expr_p, s_ann, flags);
        else
  	get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
  
!       if (code == COMPONENT_REF)
! 	get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none);
        return;
  
      case WITH_SIZE_EXPR:
        /* WITH_SIZE_EXPR is a pass-through reference to its first argument,
  	 and an rvalue reference to its second argument.  */
--- 1131,1146 ----
        if (SSA_VAR_P (TREE_OPERAND (expr, 0)))
  	add_stmt_operand (expr_p, s_ann, flags);
        else
  	get_expr_operands (stmt, &TREE_OPERAND (expr, 0), flags);
  
!       if (code == COMPONENT_REF) 
! 	{
! 	  if (TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
! 	    s_ann->has_volatile_ops = true; 
! 	  get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none);
! 	}
        return;
  
      case WITH_SIZE_EXPR:
        /* WITH_SIZE_EXPR is a pass-through reference to its first argument,
  	 and an rvalue reference to its second argument.  */


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