[Bug fortran/46838] [OOP] Wrong allocation status for polymorphic component INTENT(OUT) dummy
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 7 17:00:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46838
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-07 17:00:19 UTC ---
Work here as expected - but I get:
==32139== Conditional jump or move depends on uninitialised value(s)
==32139== at 0x400A36: cdall.1593 (oop.f90:139)
==32139== by 0x400CCE: create_matrix.1606 (oop.f90:117)
Line 139 is:
if (allocated(desc%indxmap)) then
>From the dump:
cdall (struct desc_type & restrict desc)
struct desc_type D.1561;
struct desc_type desc_type.0;
desc_type.0.matrix_data = 0B;
D.1561 = *desc;
*desc = desc_type.0;
D.1561.matrix_data = 0B;
D.1561.indxmap._data = 0B;
if (desc->indxmap._data != 0B)
The way one has to read it is as follows:
D.1561 = *desc; // Save pointers
*dest = desc_type.0; // Default initialize
// free allocatables via D.1561
The freeing works OK (except for a missing deep freeing, which is a different
PR). However, the initializing does not work. There is a line missing which
reads:
desc_type.0.indxmap._data = 0B;
The initialization happens via gfc_init_default_dt, which uses sym->value.
Hence, the problem might be in resolve.c.
* * *
Modified version: If one changes indxmap into an array, one gets:
oop.f90:21:0: internal compiler error: in gfc_conv_descriptor_data_get, at
fortran/trans-array.c:144
* * *
Reduced test case:
module descriptor_type
implicit none
type :: indx_map
end type indx_map
type desc_type
integer, allocatable :: matrix_data
class(indx_map), allocatable :: indxmap
end type desc_type
end module descriptor_type
program bug28
use descriptor_type
implicit none
type(desc_type) :: desc_a
call cdall(desc_a)
contains
subroutine cdall(desc)
type(desc_type), intent(out) :: desc
if (allocated(desc%indxmap)) stop 'ERROR'
STOP 'OK'
end subroutine cdall
end program bug28
More information about the Gcc-bugs
mailing list