https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91782

            Bug ID: 91782
           Summary: Accepts invalid array constructor with character
                    parameter
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

A parameter attribute prevents some checks in comparison to a
character variable. Affects gfortran down to at least version 5.


$ cat z1.f90
program p
   integer :: i
   character(3), parameter :: x = 'abc'
   print *, ['abc'(1:1), 'abc'(1:2), 'abc'(1:3)]
   print *, [x(1:1), x(1:2), x(1:3)]
   print *, [(x(1:i), i=1,3)]
   print *, ichar(([(x(1:i), i=1,3)]))
   print *, len_trim([(x(min(1,i):i), i=1,3)])
end


$ gfortran-10-20190915 z1.f90 && ./a.out
 aaa
 aaa
 aaa
          97          97          97
           1           1           1

Reply via email to