diff mbox

[fortran,54/66] inline sum and product: Prevent regressions: Add dependency checking.

Message ID 20111027233311.18581.79772@gimli.local
State New
Headers show

Commit Message

Mikael Morin Oct. 27, 2011, 11:33 p.m. UTC
This adds dependency checking for inline functions.
OK?
2011-10-19  Mikael Morin  <mikael@gcc.gnu.org>

	* trans.h (gfc_inline_intrinsic_function_p): Move prototype...
	* gfortran.h (gfc_inline_intrinsic_function_p): ... here.
	* dependency.c (gfc_check_argument_var_dependency): Check dependencies
	of inline intrinsics' arguments.
diff mbox

Patch

diff --git a/dependency.c b/dependency.c
index c43af00..fd7fa73 100644
--- a/dependency.c
+++ b/dependency.c
@@ -713,6 +713,17 @@  gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent,
 	    return gfc_check_fncall_dependency (var, intent, NULL,
 						expr->value.function.actual,
 						ELEM_CHECK_VARIABLE);
+
+	  if (gfc_inline_intrinsic_function_p (expr))
+	    {
+	      /* The TRANSPOSE case should have been caught in the
+		 noncopying intrinsic case above.  */
+	      gcc_assert (expr->value.function.isym->id != GFC_ISYM_TRANSPOSE);
+
+	      return gfc_check_fncall_dependency (var, intent, NULL,
+						  expr->value.function.actual,
+						  ELEM_CHECK_VARIABLE);
+	    }
 	}
       return 0;
 
diff --git a/gfortran.h b/gfortran.h
index da3477d..b869ca3 100644
--- a/gfortran.h
+++ b/gfortran.h
@@ -2880,6 +2880,9 @@  void gfc_generate_code (gfc_namespace *);
 void gfc_generate_module_code (gfc_namespace *);
 void gfc_init_coarray_decl (bool);
 
+/* trans-intrinsic.c */
+bool gfc_inline_intrinsic_function_p (gfc_expr *);
+
 /* bbt.c */
 typedef int (*compare_fn) (void *, void *);
 void gfc_insert_bbt (void *, void *, compare_fn);
diff --git a/trans.h b/trans.h
index 4d745f1..5757865 100644
--- a/trans.h
+++ b/trans.h
@@ -396,9 +396,6 @@  tree gfc_builtin_decl_for_float_kind (enum built_in_function, int);
 tree gfc_conv_intrinsic_subroutine (gfc_code *);
 void gfc_conv_intrinsic_function (gfc_se *, gfc_expr *);
 
-/* Is the intrinsic expanded inline.  */
-bool gfc_inline_intrinsic_function_p (gfc_expr *);
-
 /* Does an intrinsic map directly to an external library call
    This is true for array-returning intrinsics, unless
    gfc_inline_intrinsic_function_p returns true.  */