Commit as 'obvious' in revision 256994. I will attend to 6- and 7-branches in a little while.
Paul 2018-23-01 Paul Thomas <pa...@gcc.gnu.org> PR fortran/83898 * trans-stmt.c (trans_associate_var): Do not set cst_array_ctor for characters. 2018-23-01 Paul Thomas <pa...@gcc.gnu.org> PR fortran/83898 * gfortran.dg/associate_33.f03 : New test.
Index: gcc/fortran/trans-stmt.c =================================================================== *** gcc/fortran/trans-stmt.c (revision 256606) --- gcc/fortran/trans-stmt.c (working copy) *************** trans_associate_var (gfc_symbol *sym, gf *** 1579,1585 **** desc = sym->backend_decl; cst_array_ctor = e->expr_type == EXPR_ARRAY ! && gfc_constant_array_constructor_p (e->value.constructor); /* If association is to an expression, evaluate it and create temporary. Otherwise, get descriptor of target for pointer assignment. */ --- 1579,1586 ---- desc = sym->backend_decl; cst_array_ctor = e->expr_type == EXPR_ARRAY ! && 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. */ Index: gcc/testsuite/gfortran.dg/associate_33.f03 =================================================================== *** gcc/testsuite/gfortran.dg/associate_33.f03 (nonexistent) --- gcc/testsuite/gfortran.dg/associate_33.f03 (working copy) *************** *** 0 **** --- 1,11 ---- + ! { dg-do run } + ! + ! Test the fix for PR83898.f90 + ! + ! Contributed by G Steinmetz <gs...@t-online.de> + ! + program p + associate (x => ['1','2']) + if (any (x .ne. ['1','2'])) call abort + end associate + end