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/44154] New: initialization problem with allocatable scalars


Reported by Steve Kargl:

FAIL: gfortran.dg/class_19.f03  -O0  execution test


Reduced/modified test case:


  implicit none

  type foo
    integer, allocatable :: int(:)
  end type

  type(foo),allocatable :: try

  allocate(try)

end 


This gives (with 4.5 and trunk):

Fortran runtime error: Attempting to allocate already allocated variable 'try'

The runtime error goes away when removing the allocatable component of 'foo' or
making it non-allocatable.

With the allocatable component, the dump is missing a line like:

  try = 0B;

i.e. the allocatable scalar is not set to zero in the beginning. If 'foo' is an
allocatable array, everything is fine.


-- 
           Summary: initialization problem with allocatable scalars
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org


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


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