[Bug fortran/51976] [F2003] Support deferred-length character components of derived types (allocatable string length)

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Sun Feb 10 19:59:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51976

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-02-10 19:59:37 UTC ---
With the patch in comment #7 most of the duplicates compile and run, but:

pr49050 which gives

pr49050.f90:13.10:

   item = item_type('key')
          1
Error: No initializer for component '_key' given in the structure constructor
at (1)!

(note that the original code at 
http://gcc.gnu.org/ml/fortran/2011-05/msg00129.html compiles but segfault at
runtime);

pr51550 which gives an ICE

gimplification failed:
0 <integer_cst 0x14280bc80 type <integer_type 0x1428125e8 integer(kind=4)>
constant 0>
pr51550.f90: In function 'add_key_only':
pr51550.f90:64:0: internal compiler error: gimplification failed
     allocate( character(len=len(key)) :: value%key )
 ^

and a similar error for the test in comment #6

  type t
    character(len=:), pointer :: str
  end type t
  type(t), pointer :: strarray(:), strarray2(:)

  allocate(strarray(3), strarray2(3))
  allocate(character(len=5) :: strarray(1)%str, strarray2(1)%str)
  allocate(character(len=7) :: strarray(2)%str, strarray2(2)%str)
  allocate(character(len=2) :: strarray(2)%str, strarray2(3)%str)

!  forall(i=1:3) strarray2(i)%str = strarray(i)%str
  print *, (len(strarray2(i)%str), i=1,3)
end

gimplification failed:
0 <integer_cst 0x14280bc80 type <integer_type 0x1428125e8 integer(kind=4)>
constant 0>
pr51976_1.f90: In function 'MAIN__':
pr51976_1.f90:7:0: internal compiler error: gimplification failed
   allocate(character(len=5) :: strarray(1)%str, strarray2(1)%str)
 ^

If the FORALL is uncommented, the ICE is

pr51976_1.f90: In function 'MAIN__':
pr51976_1.f90:11:0: internal compiler error: in gfc_add_modify_loc, at
fortran/trans.c:159
   forall(i=1:3) strarray2(i)%str = strarray(i)%str
 ^

At runtime the test attached to pr48654 gives a segmentation fault (fixed by
the revised patch sent privately).

The iso_varying_string I have in store also compiles and run (limited testing).



More information about the Gcc-bugs mailing list