diff options
author | Janus Weil <janus@gcc.gnu.org> | 2013-02-21 13:26:44 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2013-02-21 13:26:44 +0100 |
commit | 84b286d05cbdff85ad3b69c6ef9a0d454157ae3a (patch) | |
tree | a7a581a12553b9f4167aebe97da1b31ec937378d /gcc | |
parent | 7df59255e1accc8f95b4d90d1a17c60cd0e6e40e (diff) | |
download | gcc-84b286d05cbdff85ad3b69c6ef9a0d454157ae3a.zip gcc-84b286d05cbdff85ad3b69c6ef9a0d454157ae3a.tar.gz gcc-84b286d05cbdff85ad3b69c6ef9a0d454157ae3a.tar.bz2 |
re PR fortran/56385 ([OOP] ICE with allocatable function result in a procedure-pointer component)
2013-02-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/56385
* trans-array.c (structure_alloc_comps): Handle procedure-pointer
components with allocatable result.
2013-02-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/56385
* gfortran.dg/proc_ptr_comp_37.f90: New.
From-SVN: r196202
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90 | 25 |
4 files changed, 40 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a8ac81a..8aeded2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-02-21 Janus Weil <janus@gcc.gnu.org> + + PR fortran/56385 + * trans-array.c (structure_alloc_comps): Handle procedure-pointer + components with allocatable result. + 2012-02-21 Tobias Burnus <burnus@net-b.de> PR fortran/56416 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index ee2954e..75fed2f 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -7547,8 +7547,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, called_dealloc_with_status = false; gfc_init_block (&tmpblock); - if (c->attr.allocatable - && (c->attr.dimension || c->attr.codimension)) + if (c->attr.allocatable && (c->attr.dimension || c->attr.codimension) + && !c->attr.proc_pointer) { comp = fold_build3_loc (input_location, COMPONENT_REF, ctype, decl, cdecl, NULL_TREE); @@ -7730,7 +7730,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, continue; } - if (c->attr.allocatable && !cmp_has_alloc_comps) + if (c->attr.allocatable && !c->attr.proc_pointer + && !cmp_has_alloc_comps) { rank = c->as ? c->as->rank : 0; tmp = gfc_duplicate_allocatable (dcmp, comp, ctype, rank); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a2e02b..90df864 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-21 Janus Weil <janus@gcc.gnu.org> + + PR fortran/56385 + * gfortran.dg/proc_ptr_comp_37.f90: New. + 2013-02-21 Richard Biener <rguenther@suse.de> PR tree-optimization/56415 diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90 new file mode 100644 index 0000000..9695b96 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! +! PR 56385: [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component +! +! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com> + + implicit none + + type :: TGeometricShape + end type + + type :: TVolumeSourceBody + class(TGeometricShape), allocatable :: GeometricShape + procedure(scalar_flux_interface), pointer :: get_scalar_flux + end type + + abstract interface + function scalar_flux_interface(self) result(res) + import + real, allocatable :: res(:) + class(TVolumeSourceBody), intent(in) :: self + end function + end interface + +end |