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/68155] ICE on initializing character array in type (len_lhs <> len_rhs)


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

--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Fails (again len_lhs <> len_rhs) :

$ cat z3t.f90
program p
   type t
      character(2) :: z(1) = 'ab' // ['y']
   end type
   type(t) :: z
   print *, z
end

$ gfortran -g -O0 -Wall -fcheck=all z3t.f90
z3t.f90:3:28:

       character(2) :: z(1) = 'ab' // ['y']
                            1
Warning: CHARACTER expression at (1) is being truncated (3/2)
[-Wcharacter-truncation]
f951: internal compiler error: Segmentation fault

---

Again, works without type :

$ cat z3c.f90
program p
   character(2) :: z(1) = 'ab' // ['y']
   print *, z
end

$ gfortran -g -O0 -Wall -fcheck=all z3c.f90
z3c.f90:2:25:

    character(2) :: z(1) = 'ab' // ['y']
                         1
Warning: CHARACTER expression at (1) is being truncated (3/2)
[-Wcharacter-truncation]

$ a.out
 ab

---

Eventually one of the recent patches cures this one too.


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