https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66694
--- Comment #9 from urbanjost at comcast dot net --- Thanks! -----Original Message----- From: pault at gcc dot gnu.org [mailto:gcc-bugzi...@gcc.gnu.org] Sent: Sunday, May 20, 2018 6:00 AM To: urbanj...@comcast.net Subject: [Bug fortran/66694] Failure in function returning an allocated CHARACTER array https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66694 --- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> --- Author: pault Date: Sun May 20 09:59:54 2018 New Revision: 260413 URL: https://gcc.gnu.org/viewcvs?rev=260413&root=gcc&view=rev Log: 2018-05-19 Paul Thomas <pa...@gcc.gnu.org> PR fortran/82923 PR fortran/66694 PR fortran/82617 * trans-array.c (gfc_alloc_allocatable_for_assignment): Set the charlen backend_decl of the rhs expr to ss->info->string_length so that the value in the current scope is used. 2018-05-19 Paul Thomas <pa...@gcc.gnu.org> PR fortran/82923 * gfortran.dg/allocate_assumed_charlen_4.f90: New test. Note that the patch fixes PR66694 & PR82617, although the testcases are not explicitly included. Added: trunk/gcc/testsuite/gfortran.dg/select_type_42.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/match.c trunk/gcc/testsuite/ChangeLog