Hello,

this renames the expr4 field of gfc_code to the more descriptive ext.lock.acquired_lock.
Regression tested on x86_64-unkown-linux-gnu.  OK for trunk?

Mikael
2015-08-05  Mikael Morin  <mik...@gcc.gnu.org>

        * gfortran.h (struct gfc_code): Move expr4 field to
        ext.lock.acquired_lock.
        * dump-parse-tree.c (show_code_node): Update field usage.
        * frontend-passes.c (gfc_code_walker): Likewise.
        * match.c (lock_unlock_statement): Likewise.
        * resolve.c (resolve_lock_unlock): Likewise.
        * trans-stmt.c (gfc_trans_lock_unlock): Likewise.
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index 83ecbaa..b782f6d 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -1669,10 +1669,10 @@ show_code_node (int level, gfc_code *c)
       fputs ("lock-variable=", dumpfile);
       if (c->expr1 != NULL)
 	show_expr (c->expr1);
-      if (c->expr4 != NULL)
+      if (c->ext.lock.acquired_lock != NULL)
 	{
 	  fputs (" acquired_lock=", dumpfile);
-	  show_expr (c->expr4);
+	  show_expr (c->ext.lock.acquired_lock);
 	}
       if (c->expr2 != NULL)
 	{
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index bc9f621..53783ea 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -3338,6 +3338,10 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
 		break;
 	      }
 
+	    case EXEC_LOCK:
+	      WALK_SUBEXPR (co->ext.lock.acquired_lock);
+	      break;
+
 	    case EXEC_FORALL:
 	    case EXEC_DO_CONCURRENT:
 	      {
@@ -3541,7 +3545,6 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
 	  WALK_SUBEXPR (co->expr1);
 	  WALK_SUBEXPR (co->expr2);
 	  WALK_SUBEXPR (co->expr3);
-	  WALK_SUBEXPR (co->expr4);
 	  for (b = co->block; b; b = b->block)
 	    {
 	      WALK_SUBEXPR (b->expr1);
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 69de5ad..27decfb 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2390,7 +2390,7 @@ typedef struct gfc_code
 
   gfc_st_label *here, *label1, *label2, *label3;
   gfc_symtree *symtree;
-  gfc_expr *expr1, *expr2, *expr3, *expr4;
+  gfc_expr *expr1, *expr2, *expr3;
   /* A name isn't sufficient to identify a subroutine, we need the actual
      symbol for the interface definition.
   const char *sub_name;  */
@@ -2412,6 +2412,13 @@ typedef struct gfc_code
     }
     alloc;
 
+    /* LOCK/UNLOCK statements  */
+    struct
+    {
+      gfc_expr *acquired_lock;
+    }
+    lock;
+
     struct
     {
       gfc_namespace *ns;
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 523e9b2..ae8e1cf 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2899,7 +2899,7 @@ done:
   new_st.expr1 = lockvar;
   new_st.expr2 = stat;
   new_st.expr3 = errmsg;
-  new_st.expr4 = acq_lock;
+  new_st.ext.lock.acquired_lock = acq_lock;
 
   return MATCH_YES;
 
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 641a3bd..c9e379d 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8730,15 +8730,16 @@ resolve_lock_unlock (gfc_code *code)
     return;
 
   /* Check ACQUIRED_LOCK.  */
-  if (code->expr4
-      && (code->expr4->ts.type != BT_LOGICAL || code->expr4->rank != 0
-	  || code->expr4->expr_type != EXPR_VARIABLE))
+  if (code->ext.lock.acquired_lock
+      && (code->ext.lock.acquired_lock->ts.type != BT_LOGICAL
+	  || code->ext.lock.acquired_lock->rank != 0
+	  || code->ext.lock.acquired_lock->expr_type != EXPR_VARIABLE))
     gfc_error ("ACQUIRED_LOCK= argument at %L must be a scalar LOGICAL "
-	       "variable", &code->expr4->where);
+	       "variable", &code->ext.lock.acquired_lock->where);
 
-  if (code->expr4
-      && !gfc_check_vardef_context (code->expr4, false, false, false,
-				    _("ACQUIRED_LOCK variable")))
+  if (code->ext.lock.acquired_lock
+      && !gfc_check_vardef_context (code->ext.lock.acquired_lock, false, false,
+				    false, _("ACQUIRED_LOCK variable")))
     return;
 }
 
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6409f7f..5d140d6 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -681,7 +681,9 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op)
 
   /* Short cut: For single images without STAT= or LOCK_ACQUIRED
      return early. (ERRMSG= is always untouched for -fcoarray=single.)  */
-  if (!code->expr2 && !code->expr4 && flag_coarray != GFC_FCOARRAY_LIB)
+  if (!code->expr2
+      && !code->ext.lock.acquired_lock
+      && flag_coarray != GFC_FCOARRAY_LIB)
     return NULL_TREE;
 
   if (code->expr2)
@@ -694,11 +696,11 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op)
   else if (flag_coarray == GFC_FCOARRAY_LIB)
     stat = null_pointer_node;
 
-  if (code->expr4)
+  if (code->ext.lock.acquired_lock)
     {
-      gcc_assert (code->expr4->expr_type == EXPR_VARIABLE);
+      gcc_assert (code->ext.lock.acquired_lock->expr_type == EXPR_VARIABLE);
       gfc_init_se (&argse, NULL);
-      gfc_conv_expr_val (&argse, code->expr4);
+      gfc_conv_expr_val (&argse, code->ext.lock.acquired_lock);
       lock_acquired = argse.expr;
     }
   else if (flag_coarray == GFC_FCOARRAY_LIB)

Reply via email to