aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-08-25 17:59:40 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-08-25 17:59:40 +0200
commit241e79cfc4264dec4eaf1e8af890da3527c99193 (patch)
tree5fe429060de3f16e0acb93e0ee8d122619a38ffa /gcc
parent3e4c754bbf3709a6dcd41e672e5e90d5c582aaca (diff)
downloadgcc-241e79cfc4264dec4eaf1e8af890da3527c99193.zip
gcc-241e79cfc4264dec4eaf1e8af890da3527c99193.tar.gz
gcc-241e79cfc4264dec4eaf1e8af890da3527c99193.tar.bz2
trans-array.c (structure_alloc_comps): Fix for allocatable scalar coarray components.
2011-08-25 Tobias Burnus <burnus@net-b.de> * trans-array.c (structure_alloc_comps): Fix for allocatable scalar coarray components. * trans-expr.c (gfc_conv_component_ref): Ditto. * trans-type.c (gfc_get_derived_type): Ditto. 2011-08-25 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray/alloc_comp_1.f90: New. From-SVN: r178068
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-array.c6
-rw-r--r--gcc/fortran/trans-expr.c3
-rw-r--r--gcc/fortran/trans-types.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f9016
6 files changed, 34 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ed4dc77..1c4a673 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-25 Tobias Burnus <burnus@net-b.de>
+
+ * trans-array.c (structure_alloc_comps): Fix for allocatable
+ scalar coarray components.
+ * trans-expr.c (gfc_conv_component_ref): Ditto.
+ * trans-type.c (gfc_get_derived_type): Ditto.
+
2011-08-24 Tobias Burnus <burnus@net-b.de>
PR fortran/50163
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 3a75658..bd9e88e 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -6798,7 +6798,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_add_expr_to_block (&fnblock, tmp);
}
- if (c->attr.allocatable && c->attr.dimension)
+ if (c->attr.allocatable
+ && (c->attr.dimension || c->attr.codimension))
{
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
@@ -6845,7 +6846,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
case NULLIFY_ALLOC_COMP:
if (c->attr.pointer)
continue;
- else if (c->attr.allocatable && c->attr.dimension)
+ else if (c->attr.allocatable
+ && (c->attr.dimension|| c->attr.codimension))
{
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 39a83ce..531a135 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -564,7 +564,8 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
se->string_length = tmp;
}
- if (((c->attr.pointer || c->attr.allocatable) && c->attr.dimension == 0
+ if (((c->attr.pointer || c->attr.allocatable)
+ && (!c->attr.dimension && !c->attr.codimension)
&& c->ts.type != BT_CHARACTER)
|| c->attr.proc_pointer)
se->expr = build_fold_indirect_ref_loc (input_location,
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index bec2a11..bac5b31 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2395,7 +2395,7 @@ gfc_get_derived_type (gfc_symbol * derived)
/* This returns an array descriptor type. Initialization may be
required. */
- if (c->attr.dimension && !c->attr.proc_pointer)
+ if ((c->attr.dimension || c->attr.codimension) && !c->attr.proc_pointer )
{
if (c->attr.pointer || c->attr.allocatable)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eda284a..30b48b4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-25 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/coarray/alloc_comp_1.f90: New.
+
2011-08-25 Richard Guenther <rguenther@suse.de>
* gcc.dg/Wshadow-3.c: Restore original content destroyed by r148442.
diff --git a/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90 b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90
new file mode 100644
index 0000000..6baeabf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90
@@ -0,0 +1,16 @@
+! { dg-do run }
+!
+! Allocatable scalar corrays were mishandled (ICE)
+!
+type t
+ integer, allocatable :: caf[:]
+end type t
+type(t) :: a
+allocate (a%caf[3:*])
+a%caf = 7
+!print *, a%caf
+if (a%caf /= 7) call abort ()
+if (any (lcobound (a%caf) /= [ 3 ]) &
+ .or. ucobound (a%caf, dim=1) /= this_image ()+2) &
+ call abort ()
+end