https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80120
Bug ID: 80120 Summary: Incorrect error with associate construct and character array (regression) Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mrestelli at gmail dot com Target Milestone: --- Recent gfortran does not compile the following valid code: program p implicit none type :: t character(len=25) :: text(2) end type t type(t) :: x x%text(1) = "ABC" x%text(2) = "defgh" associate( c => x%text ) write(*,*) c(:)(:maxval(len_trim(c))) end associate end program p The error message is $ gfortran test.f90 -o test test.f90:13:16: write(*,*) c(:)(:maxval(len_trim(c))) 1 Error: Syntax error in WRITE statement at (1) I see the problem with $ gfortran --version GNU Fortran (GCC) 7.0.1 20170317 (experimental) while this version works: $ gfortran --version GNU Fortran (Gentoo 4.9.4 p1.0, pie-0.6.4) 4.9.4 The expected output is $ ./test ABC defgh