aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2006-06-20 04:30:48 +0000
committerPaul Thomas <pault@gcc.gnu.org>2006-06-20 04:30:48 +0000
commita4a11197f9f65c5523da3ce588d7508e47f801ab (patch)
treeac18f8deb5aff7c9354a8879e1c428d69345b10f /gcc/fortran/check.c
parent73dab33bce6cc186f05ac0cf45e42c58f9086b3c (diff)
downloadgcc-a4a11197f9f65c5523da3ce588d7508e47f801ab.zip
gcc-a4a11197f9f65c5523da3ce588d7508e47f801ab.tar.gz
gcc-a4a11197f9f65c5523da3ce588d7508e47f801ab.tar.bz2
re PR fortran/25049 (TRANSPOSE not allowed in initialisation expression)
2006-06-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/25049 PR fortran/25050 * check.c (non_init_transformational): New function. (find_substring_ref): New function to signal use of disallowed transformational intrinsic in an initialization expression. (gfc_check_all_any): Call previous if initialization expr. (gfc_check_count): The same. (gfc_check_cshift): The same. (gfc_check_dot_product): The same. (gfc_check_eoshift): The same. (gfc_check_minloc_maxloc): The same. (gfc_check_minval_maxval): The same. (gfc_check_gfc_check_product_sum): The same. (gfc_check_pack): The same. (gfc_check_spread): The same. (gfc_check_transpose): The same. (gfc_check_unpack): The same. PR fortran/18769 *intrinsic.c (add_functions): Add gfc_simplify_transfer. *intrinsic.h : Add prototype for gfc_simplify_transfer. *simplify.c (gfc_simplify_transfer) : New function to act as placeholder for eventual implementation. Emit error for now. PR fortran/16206 * expr.c (find_array_element): Eliminate condition on length of offset. Add bounds checking. Rearrange exit. Return try and put gfc_constructor result as an argument. (find_array_section): New function. (find_substring_ref): New function. (simplify_const_ref): Add calls to previous. (simplify_parameter_variable): Return on NULL expr. (gfc_simplify_expr): Only call gfc_expand_constructor for full arrays. PR fortran/20876 * match.c (gfc_match_forall): Add missing locus to gfc_code. 2006-06-20 Paul Thomas <pault@gcc.gnu.org> PR libfortran/28005 * m4/matmul.m4: aystride = 1 does not uniquely detect the presence of a temporary transpose; an array element in the first dimension produces the same signature. Detect this using the rank of a and add specific code. * generated/matmul_r4.c: Regenerate. * generated/matmul_r8.c: Regenerate. * generated/matmul_r10.c: Regenerate. * generated/matmul_r16.c: Regenerate. * generated/matmul_c4.c: Regenerate. * generated/matmul_c8.c: Regenerate. * generated/matmul_c10.c: Regenerate. * generated/matmul_c16.c: Regenerate. * generated/matmul_i4.c: Regenerate. * generated/matmul_i8.c: Regenerate. * generated/matmul_i16.c: Regenerate. 2006-06-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/16206 * gfortran.dg/array_initializer_1.f90: New test. PR fortran/28005 * gfortran.dg/matmul_3.f90: New test. From-SVN: r114802
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 15278f4..6ca5246 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -378,6 +378,18 @@ identical_dimen_shape (gfc_expr *a, int ai, gfc_expr *b, int bi)
return ret;
}
+/* Error return for transformational intrinsics not allowed in
+ initalization expressions. */
+
+static try
+non_init_transformational (void)
+{
+ gfc_error ("transformational intrinsic '%s' at %L is not permitted "
+ "in an initialization expression", gfc_current_intrinsic,
+ gfc_current_intrinsic_where);
+ return FAILURE;
+}
+
/***** Check functions *****/
/* Check subroutine suitable for intrinsics taking a real argument and
@@ -439,6 +451,9 @@ gfc_check_all_any (gfc_expr * mask, gfc_expr * dim)
if (dim_check (dim, 1, 1) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -724,6 +739,9 @@ gfc_check_count (gfc_expr * mask, gfc_expr * dim)
if (dim_check (dim, 1, 1) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -747,6 +765,9 @@ gfc_check_cshift (gfc_expr * array, gfc_expr * shift, gfc_expr * dim)
if (dim_check (dim, 2, 1) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -848,6 +869,9 @@ gfc_check_dot_product (gfc_expr * vector_a, gfc_expr * vector_b)
return FAILURE;
}
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -883,6 +907,9 @@ gfc_check_eoshift (gfc_expr * array, gfc_expr * shift, gfc_expr * boundary,
if (dim_check (dim, 1, 1) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -1545,6 +1572,9 @@ gfc_check_matmul (gfc_expr * matrix_a, gfc_expr * matrix_b)
return FAILURE;
}
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -1605,6 +1635,9 @@ gfc_check_minloc_maxloc (gfc_actual_arglist * ap)
return FAILURE;
}
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -1673,6 +1706,9 @@ gfc_check_minval_maxval (gfc_actual_arglist * ap)
|| array_check (ap->expr, 0) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return check_reduction (ap);
}
@@ -1684,6 +1720,9 @@ gfc_check_product_sum (gfc_actual_arglist * ap)
|| array_check (ap->expr, 0) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return check_reduction (ap);
}
@@ -1781,6 +1820,9 @@ gfc_check_pack (gfc_expr * array, gfc_expr * mask, gfc_expr * vector)
/* TODO: More constraints here. */
}
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -2152,6 +2194,9 @@ gfc_check_spread (gfc_expr * source, gfc_expr * dim, gfc_expr * ncopies)
if (scalar_check (ncopies, 2) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -2367,6 +2412,9 @@ gfc_check_transpose (gfc_expr * matrix)
if (rank_check (matrix, 0, 2) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}
@@ -2405,6 +2453,9 @@ gfc_check_unpack (gfc_expr * vector, gfc_expr * mask, gfc_expr * field)
if (same_type_check (vector, 0, field, 2) == FAILURE)
return FAILURE;
+ if (gfc_init_expr)
+ return non_init_transformational ();
+
return SUCCESS;
}