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/27470] New: [4.1 4.2 regression] wong memory allocator for derived types


The following code

 TYPE foo
   INTEGER, DIMENSION(:), POINTER :: array
 END TYPE foo

 type(foo),allocatable,dimension(:) :: mol
 integer :: i, n

 n = 10
 ALLOCATE (mol(n))


 ALLOCATE (mol(1)%array(5))

 END

calls _gfortran_allocate_array for the second allocation, which
is wrong and can lead to segfault.

The problem is in gfc_array_allocate, where the check for

   expr->symtree->n.sym->attr.allocatable

refers to mol, not to mol(1)%array.

This one is tricky.


-- 
           Summary: [4.1 4.2 regression] wong memory allocator for derived
                    types
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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