This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/69962] New: ICE on missing parameter attribute, in gfc_set_constant_character_len


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

            Bug ID: 69962
           Summary: ICE on missing parameter attribute, in
                    gfc_set_constant_character_len
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

The following snippet is wrong because n is not declared as parameter :


$ cat z1.f90
program p
   integer :: n = 1
   character(3), parameter :: x(2) = ['abc', 'xyz']
   character(2), parameter :: y(2) = [x(2)(2:3), x(n)(1:2)]
end


$ gfortran-6 z1.f90
f951: internal compiler error: in gfc_set_constant_character_len, at
fortran/decl.c:1304

---

Correct with parameter attribute :


$ cat z2.f90
program p
   integer, parameter :: n = 1
   character(3), parameter :: x(2) = ['abc', 'xyz']
   character(2), parameter :: y(2) = [x(2)(2:3), x(n)(1:2)]
   print *, x
   print *, y
end


$ gfortran-6 z2.f90
$ a.out
 abcxyz
 yzab

---

Thematically related to pr66107.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]