aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2017-10-27 17:11:42 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2017-10-27 17:11:42 +0000
commit6c6bde30706c29ffe41415f95ef3f48b6712cbe7 (patch)
tree71e73a69c0cee745422b73c9d7ac3695e5d64c23 /gcc/fortran/simplify.c
parenta09ca93a71be0b9b3c2f8ff0181293a6036f0282 (diff)
downloadgcc-6c6bde30706c29ffe41415f95ef3f48b6712cbe7.zip
gcc-6c6bde30706c29ffe41415f95ef3f48b6712cbe7.tar.gz
gcc-6c6bde30706c29ffe41415f95ef3f48b6712cbe7.tar.bz2
re PR fortran/56342 (MATMUL with PARAMETER: Simplification usually doesn't work)
2017-10-27 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56342 * simplify.c (is_constant_array_expr): If the expression is a parameter array, call gfc_simplify_expr. 2017-10-27 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56342 * gfortran.dg/matmul_const.f90: New test. From-SVN: r254157
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 169aef1..ba010a0 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -227,7 +227,8 @@ convert_boz (gfc_expr *x, int kind)
}
-/* Test that the expression is an constant array. */
+/* Test that the expression is an constant array, simplifying if
+ we are dealing with a parameter array. */
static bool
is_constant_array_expr (gfc_expr *e)
@@ -237,6 +238,10 @@ is_constant_array_expr (gfc_expr *e)
if (e == NULL)
return true;
+ if (e->expr_type == EXPR_VARIABLE && e->rank > 0
+ && e->symtree->n.sym->attr.flavor == FL_PARAMETER)
+ gfc_simplify_expr (e, 1);
+
if (e->expr_type != EXPR_ARRAY || !gfc_is_constant_expr (e))
return false;