+2013-01-04 Tobias Burnus <burnus@net-b.de>
+
+ * intrinsic.c (add_functions): New internal intrinsic
+ function GFC_PREFIX ("stride").
+ * gfortran.h (gfc_isym_id): Add GFC_ISYM_STRIDE.
+ * intrinsic.h (gfc_resolve_stride): New prototypes.
+ * iresolve.c (gfc_resolve_stride): New function.
+ * trans-intrinsic.c (conv_intrinsic_stride): New static
+ function.
+ (gfc_conv_intrinsic_function): Use it.
+
2013-01-04 Tobias Burnus <burnus@net-b.de>
* class.c (gfc_find_intrinsic_vtab): Add _final
component.
+ * decl.c (gfc_match_null): Remove superfluous
+ variadic argument to gfc_match.
2013-01-04 Paul Thomas <pault@gcc.gnu.org>
GFC_ISYM_SR_KIND,
GFC_ISYM_STAT,
GFC_ISYM_STORAGE_SIZE,
+ GFC_ISYM_STRIDE,
GFC_ISYM_SUM,
GFC_ISYM_SYMLINK,
GFC_ISYM_SYMLNK,
make_generic ("size", GFC_ISYM_SIZE, GFC_STD_F95);
+ /* Obtain the stride for a given dimensions; to be used only internally.
+ "make_from_module" makes inaccessible for external users. */
+ add_sym_2 (GFC_PREFIX ("stride"), GFC_ISYM_STRIDE, CLASS_INQUIRY, ACTUAL_NO,
+ BT_INTEGER, gfc_index_integer_kind, GFC_STD_GNU,
+ NULL, NULL, gfc_resolve_stride,
+ ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL);
+ make_from_module();
+
add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, ii,
GFC_STD_GNU, gfc_check_sizeof, NULL, NULL,
x, BT_UNKNOWN, 0, REQUIRED);
void gfc_resolve_sin (gfc_expr *, gfc_expr *);
void gfc_resolve_sinh (gfc_expr *, gfc_expr *);
void gfc_resolve_size (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
+void gfc_resolve_stride (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_spacing (gfc_expr *, gfc_expr *);
void gfc_resolve_spread (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_sqrt (gfc_expr *, gfc_expr *);
}
+void
+gfc_resolve_stride (gfc_expr *f, gfc_expr *array ATTRIBUTE_UNUSED,
+ gfc_expr *dim ATTRIBUTE_UNUSED)
+{
+ f->ts.type = BT_INTEGER;
+ f->ts.kind = gfc_index_integer_kind;
+}
+
+
void
gfc_resolve_spacing (gfc_expr *f, gfc_expr *x)
{
}
+static void
+conv_intrinsic_stride (gfc_se * se, gfc_expr * expr)
+{
+ gfc_actual_arglist *array_arg;
+ gfc_actual_arglist *dim_arg;
+ gfc_se argse;
+ tree desc, tmp;
+
+ array_arg = expr->value.function.actual;
+ dim_arg = array_arg->next;
+
+ gcc_assert (array_arg->expr->expr_type == EXPR_VARIABLE);
+
+ gfc_init_se (&argse, NULL);
+ gfc_conv_expr_descriptor (&argse, array_arg->expr);
+ gfc_add_block_to_block (&se->pre, &argse.pre);
+ gfc_add_block_to_block (&se->post, &argse.post);
+ desc = argse.expr;
+
+ gcc_assert (dim_arg->expr);
+ gfc_init_se (&argse, NULL);
+ gfc_conv_expr_type (&argse, dim_arg->expr, gfc_array_index_type);
+ gfc_add_block_to_block (&se->pre, &argse.pre);
+ tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type,
+ argse.expr, gfc_index_one_node);
+ se->expr = gfc_conv_descriptor_stride_get (desc, tmp);
+}
+
+
static void
gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr)
{
gfc_conv_intrinsic_spacing (se, expr);
break;
+ case GFC_ISYM_STRIDE:
+ conv_intrinsic_stride (se, expr);
+ break;
+
case GFC_ISYM_SUM:
gfc_conv_intrinsic_arith (se, expr, PLUS_EXPR, false);
break;