[Bug fortran/30115] allocate() interface pessimizes aliasing
tkoenig at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Dec 8 22:54:00 GMT 2006
------- Comment #5 from tkoenig at gcc dot gnu dot org 2006-12-08 22:54 -------
(In reply to comment #1)
> if (TYPE_PRECISION (gfc_array_index_type) == 32)
> {
> if (allocatable_array)
> - allocate = gfor_fndecl_allocate_array;
> + allocate = gfor_fndecl_internal_malloc;
> else
> - allocate = gfor_fndecl_allocate;
> + allocate = gfor_fndecl_internal_malloc;
This patch, as-is, will very likely violate the Fortran standard.
See, for example, multiple_allocation_1.f90:
allocate(a(4))
! This should set the stat code and change the size.
allocate(a(3),stat=i)
if (i == 0) call abort
if (.not. allocated(a)) call abort
if (size(a) /= 3) call abort
! It's OK to allocate pointers twice (even though this causes
! a memory leak)
allocate(b(4))
allocate(b(4))
The check wether size(a) is three isn't required by the standard.
The logic that is currently within the library would need to
be moved into the front end.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30115
More information about the Gcc-bugs
mailing list