From 84ee745e333717fb3b64f66310499993c5ee1835 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Tue, 23 Jan 2018 19:10:48 +0000 Subject: [PATCH] re PR fortran/83898 (ICE in gfc_conv_expr_descriptor, at fortran/trans-array.c:7181) 2018-23-01 Paul Thomas PR fortran/83898 * trans-stmt.c (trans_associate_var): Do not set cst_array_ctor for characters. 2018-23-01 Paul Thomas PR fortran/83898 * gfortran.dg/associate_33.f03 : New test. From-SVN: r256994 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-stmt.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/associate_33.f03 | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/associate_33.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f8a7c9a3a0b..f50d8a8b283 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-23-01 Paul Thomas + + PR fortran/83898 + * trans-stmt.c (trans_associate_var): Do not set cst_array_ctor + for characters. + 2018-01-22 Janne Blomqvist PR 78534 diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index ff6e5914319..df83a2b6647 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -1579,7 +1579,8 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) desc = sym->backend_decl; cst_array_ctor = e->expr_type == EXPR_ARRAY - && gfc_constant_array_constructor_p (e->value.constructor); + && gfc_constant_array_constructor_p (e->value.constructor) + && e->ts.type != BT_CHARACTER; /* If association is to an expression, evaluate it and create temporary. Otherwise, get descriptor of target for pointer assignment. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7211ce8228..d6e6709077f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-23-01 Paul Thomas + + PR fortran/83898 + * gfortran.dg/associate_33.f03 : New test. + 2018-01-23 Martin Liska PR lto/81440 diff --git a/gcc/testsuite/gfortran.dg/associate_33.f03 b/gcc/testsuite/gfortran.dg/associate_33.f03 new file mode 100644 index 00000000000..1f87b22e8e4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_33.f03 @@ -0,0 +1,11 @@ +! { dg-do run } +! +! Test the fix for PR83898.f90 +! +! Contributed by G Steinmetz +! +program p + associate (x => ['1','2']) + if (any (x .ne. ['1','2'])) call abort + end associate +end -- 2.30.2