diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2009-06-07 07:53:21 -0400 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2009-06-07 13:53:21 +0200 |
commit | 8ec259c12bf6fdaefa2221a08be3e5f90185567b (patch) | |
tree | 2e75ad1b42bc85ad8644cffb94677a120f3f3547 /gcc/fortran/expr.c | |
parent | 5bca4e800bc5a61148a74c4656b274155275f9fc (diff) | |
download | gcc-8ec259c12bf6fdaefa2221a08be3e5f90185567b.zip gcc-8ec259c12bf6fdaefa2221a08be3e5f90185567b.tar.gz gcc-8ec259c12bf6fdaefa2221a08be3e5f90185567b.tar.bz2 |
re PR fortran/25104 ([F2003] Non-initialization expr. as case-selector)
2009-06-07 Daniel Franke <franke.daniel@gmail.com>
PR fortran/25104
PR fortran/29962
* intrinsic.h (gfc_simplify_dot_product): New prototype.
(gfc_simplify_matmul): Likewise.
(gfc_simplify_transpose): Likewise.
* intrinsic.c (add_functions): Added new simplifier callbacks.
* simplify.c (init_result_expr): New.
(compute_dot_product): New.
(gfc_simplify_dot_product): New.
(gfc_simplify_matmul): New.
(gfc_simplify_transpose): New.
* expr.c (check_transformational): Allow transformational
* intrinsics
with simplifier in initialization expression.
2009-06-07 Daniel Franke <franke.daniel@gmail.com>
PR fortran/25104
PR fortran/29962
* gfortran.dg/dot_product_1.f03: New.
* gfortran.dg/matmul_8.f03: New.
* gfortran.dg/transpose_3.f03: New.
From-SVN: r148243
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 2c70ba6..31b0df1 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2127,8 +2127,15 @@ check_transformational (gfc_expr *e) "selected_real_kind", "transfer", "trim", NULL }; + static const char * const trans_func_f2003[] = { + "dot_product", "matmul", "null", "pack", "repeat", + "reshape", "selected_char_kind", "selected_int_kind", + "selected_real_kind", "transfer", "transpose", "trim", NULL + }; + int i; const char *name; + const char *const *functions; if (!e->value.function.isym || !e->value.function.isym->transformational) @@ -2136,31 +2143,23 @@ check_transformational (gfc_expr *e) name = e->symtree->n.sym->name; + functions = (gfc_option.allow_std & GFC_STD_F2003) + ? trans_func_f2003 : trans_func_f95; + /* NULL() is dealt with below. */ if (strcmp ("null", name) == 0) return MATCH_NO; - for (i = 0; trans_func_f95[i]; i++) - if (strcmp (trans_func_f95[i], name) == 0) - break; + for (i = 0; functions[i]; i++) + if (strcmp (functions[i], name) == 0) + break; - /* FIXME, F2003: implement translation of initialization - expressions before enabling this check. For F95, error - out if the transformational function is not in the list. */ -#if 0 - if (trans_func_f95[i] == NULL - && gfc_notify_std (GFC_STD_F2003, - "transformational intrinsic '%s' at %L is not permitted " - "in an initialization expression", name, &e->where) == FAILURE) - return MATCH_ERROR; -#else - if (trans_func_f95[i] == NULL) + if (functions[i] == NULL) { gfc_error("transformational intrinsic '%s' at %L is not permitted " "in an initialization expression", name, &e->where); return MATCH_ERROR; } -#endif return check_init_expr_arguments (e); } |