Blob Blame History Raw
2008-04-15  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/35899
	* tree-inline.c (expand_call_inline): Use GIMPLE_STMT_OPERAND
	rather than TREE_OPERAND.

	* gcc.dg/pr35899.c: New test.

--- gcc/tree-inline.c.jj	2008-04-03 09:41:42.000000000 +0200
+++ gcc/tree-inline.c	2008-04-15 18:18:56.000000000 +0200
@@ -2868,15 +2868,15 @@ expand_call_inline (basic_block bb, tree
       if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
 	  && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME)
 	{
-	  tree name = TREE_OPERAND (stmt, 0);
-	  tree var = SSA_NAME_VAR (TREE_OPERAND (stmt, 0));
+	  tree name = GIMPLE_STMT_OPERAND (stmt, 0);
+	  tree var = SSA_NAME_VAR (GIMPLE_STMT_OPERAND (stmt, 0));
 	  tree def = gimple_default_def (cfun, var);
 
 	  /* If the variable is used undefined, make this name undefined via
 	     move.  */
 	  if (def)
 	    {
-	      TREE_OPERAND (stmt, 1) = def;
+	      GIMPLE_STMT_OPERAND (stmt, 1) = def;
 	      update_stmt (stmt);
 	    }
 	  /* Otherwise make this variable undefined.  */
--- gcc/testsuite/gcc.dg/pr35899.c.jj	2008-04-15 18:45:24.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr35899.c	2008-04-15 18:43:10.000000000 +0200
@@ -0,0 +1,15 @@
+/* PR tree-optimization/35899 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+  int a = bar ();	/* { dg-warning "previous implicit declaration" } */
+  return a;
+}
+
+void
+bar (void)		/* { dg-warning "conflicting types for" } */
+{
+}