[Bug fortran/30660] [4.2 and 4.1 only] Allocatable components of a derived type "require" the SAVE attribute.

toon at moene dot indiv dot nluug dot nl gcc-bugzilla@gcc.gnu.org
Sun Feb 4 13:17:00 GMT 2007



------- Comment #5 from toon at moene dot indiv dot nluug dot nl  2007-02-04 13:17 -------
It's not completely fixed yet, though.

The following:

MODULE types_m

  TYPE coord_t
    INTEGER ncord
    REAL,ALLOCATABLE,DIMENSION(:) :: x, y
  END TYPE

  TYPE grib_t
    INTEGER ksec0(2), ksec1(64), ksec2(64), ksec3(2), ksec4(64)
    REAL psec2(512), psec3(3)
    LOGICAL packed ! if packed then the data are stored in g_work
    INTEGER npts
    REAL,DIMENSION(:),ALLOCATABLE :: vdata
    TYPE(coord_t) coords
  END TYPE

END MODULE

MODULE globals_m
  USE types_m
  TYPE(grib_t) g_dest           ! output field
END MODULE

still fails with:

globals.f90:21.21:

  TYPE(grib_t) g_dest  ! output field
                    1
Error: Object 'g_dest' at (1) must have the SAVE attribute for default
initialization of a component

probably because of the nested nature of the allocatable component in coord_t.

Hope this helps.


-- 


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



More information about the Gcc-bugs mailing list