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 22171


My patch for PR 22000 was buggy in that I assumed that s_ann was
non-NULL; as shown by PR 22171 and confirmed by similar code in
add_stmt_operand it's possible for s_ann to be NULL.

Committed as obvious to 4.0 branch and mainline.

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

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

	PR 22171
	* tree-ssa-operands.c (get_expr_operands): Check s_ann for NULL
	before use.

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

	PR 22171
	* gcc.dg/tree-ssa/pr22171.c: New test.

Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.88
diff -c -5 -p -r2.88 tree-ssa-operands.c
*** tree-ssa-operands.c	24 Jun 2005 03:38:05 -0000	2.88
--- tree-ssa-operands.c	24 Jun 2005 13:15:43 -0000
*************** get_expr_operands (tree stmt, tree *expr
*** 1345,1355 ****
  	  get_expr_operands (stmt, &TREE_OPERAND (expr, 0), 
  			     flags & ~opf_kill_def);
  	
  	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;
        }
--- 1345,1355 ----
  	  get_expr_operands (stmt, &TREE_OPERAND (expr, 0), 
  			     flags & ~opf_kill_def);
  	
  	if (code == COMPONENT_REF)
  	  {
! 	    if (s_ann && TREE_THIS_VOLATILE (TREE_OPERAND (expr, 1)))
  	      s_ann->has_volatile_ops = true; 
  	    get_expr_operands (stmt, &TREE_OPERAND (expr, 2), opf_none);
  	  }
  	return;
        }
Index: testsuite/gcc.dg/tree-ssa/pr22171.c
===================================================================
RCS file: testsuite/gcc.dg/tree-ssa/pr22171.c
diff -N testsuite/gcc.dg/tree-ssa/pr22171.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/tree-ssa/pr22171.c	24 Jun 2005 13:15:43 -0000
***************
*** 0 ****
--- 1,28 ----
+ /* { dg-options "-O2" } */
+ 
+ static unsigned int old_serial_port_irq[10];
+ 
+ static struct uart_8250_port {
+   volatile unsigned int slock;
+   unsigned int irq;
+ } serial8250_ports[10];
+ 
+ static __inline__ __attribute__((always_inline)) int irq_canonicalize(int irq)
+ {
+   return ((irq == 2) ? 9 : irq);
+ }
+ 
+ void serial8250_isa_init_ports(void)
+ {
+   struct uart_8250_port *up;
+   int i;
+ 
+   for (i = 0, up = serial8250_ports; i < 10; i++, up++)
+     up->irq = irq_canonicalize(old_serial_port_irq[i]);
+ }
+ 
+ int main(void)
+ {
+   serial8250_isa_init_ports();
+   return 0;
+ }


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