diff options
author | Tobias Burnus <burnus@net-b.de> | 2013-04-12 19:55:48 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2013-04-12 19:55:48 +0200 |
commit | 14c96bcafde23000b572ce0f46f0157901128c07 (patch) | |
tree | bb36dcfe9306bd493c170e1b146e9a35c0a7283e /gcc | |
parent | 226e378f4d94cf604547dd4d1c1de624beab5fb0 (diff) | |
download | gcc-14c96bcafde23000b572ce0f46f0157901128c07.zip gcc-14c96bcafde23000b572ce0f46f0157901128c07.tar.gz gcc-14c96bcafde23000b572ce0f46f0157901128c07.tar.bz2 |
re PR fortran/56929 ([OOP] [F08] ICE on dummy argument child class with coarray inside parent)
2013-04-12 Tobias Burnus <burnus@net-b.de>
PR fortran/56929
* trans-array.c (duplicate_allocatable): Fix handling
of scalar coarrays.
2013-04-12 Tobias Burnus <burnus@net-b.de>
PR fortran/56929
* gfortran.dg/coarray/alloc_comp_2.f90: New.
From-SVN: r197930
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/coarray/alloc_comp_2.f90 | 19 |
4 files changed, 37 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e290e49..c2b8a5d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-04-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/56929 + * trans-array.c (duplicate_allocatable): Fix handling + of scalar coarrays. + 2013-04-12 Janus Weil <janus@gcc.gnu.org> PR fortran/56261 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 05de50d..6cb85d4 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -7321,7 +7321,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank, allocate memory to the destination. */ gfc_init_block (&block); - if (rank == 0) + if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest))) { tmp = null_pointer_node; tmp = fold_build2_loc (input_location, MODIFY_EXPR, type, dest, tmp); @@ -7348,7 +7348,11 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank, null_data = gfc_finish_block (&block); gfc_init_block (&block); - nelems = get_full_array_size (&block, src, rank); + if (rank) + nelems = get_full_array_size (&block, src, rank); + else + nelems = gfc_index_one_node; + tmp = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (gfc_get_element_type (type))); size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, @@ -7374,7 +7378,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank, /* Null the destination if the source is null; otherwise do the allocate and copy. */ - if (rank == 0) + if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (src))) null_cond = src; else null_cond = gfc_conv_descriptor_data_get (src); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4fefc5..2f505a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/56929 + * gfortran.dg/coarray/alloc_comp_2.f90: New. + 2013-04-12 Vladimir Makarov <vmakarov@redhat.com> PR target/56903 diff --git a/gcc/testsuite/gfortran.dg/coarray/alloc_comp_2.f90 b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_2.f90 new file mode 100644 index 0000000..13c823e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_2.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! +! PR fortran/56929 +! +! Contributed by Damian Rouson +! +! Allocatable scalar corrays were mishandled (ICE) +! +module parent_coarray_component + type parent + real, allocatable :: dummy[:] + end type + type, extends(parent) :: child + end type +contains + subroutine do_something(this) + class(child) this + end +end |