aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-05-15 18:20:18 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-05-15 18:20:18 +0200
commit4ca9939b79bee5da542bf534cf4b51132360f496 (patch)
tree21cefbeb280a023f07695694e5881ebc038308be /gcc/fortran
parent29eabd788fd921611c5800e2d173f097bdabd117 (diff)
downloadgcc-4ca9939b79bee5da542bf534cf4b51132360f496.zip
gcc-4ca9939b79bee5da542bf534cf4b51132360f496.tar.gz
gcc-4ca9939b79bee5da542bf534cf4b51132360f496.tar.bz2
re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-05-15 Tobias Burnus <burnus@net-b.de> PR fortran/18918 actual argument is not an array; rank mismatch is diagnosted later. * trans-decl.c (gfc_get_symbol_decl, gfc_trans_deferred_vars): * Handle scalar coarrays. * trans-types.c (gfc_get_array_type_bounds): Ditto. 2011-05-15 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * gfortran.dg/coarray/image_index_2.f90: New. From-SVN: r173772
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/trans-decl.c7
-rw-r--r--gcc/fortran/trans-types.c11
3 files changed, 21 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index bd9cdcb..0300b1d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-15 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/18918
+ actual argument is not an array; rank mismatch is diagnosted later.
+ * trans-decl.c (gfc_get_symbol_decl, gfc_trans_deferred_vars): Handle
+ scalar coarrays.
+ * trans-types.c (gfc_get_array_type_bounds): Ditto.
+
2011-05-15 Joern Rennecke <amylaar@spamcop.net>
PR middle-end/46500
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index f0138b0..d771484 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1228,7 +1228,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
}
/* Use a copy of the descriptor for dummy arrays. */
- if (sym->attr.dimension && !TREE_USED (sym->backend_decl))
+ if ((sym->attr.dimension || sym->attr.codimension)
+ && !TREE_USED (sym->backend_decl))
{
decl = gfc_build_dummy_array_decl (sym, sym->backend_decl);
/* Prevent the dummy from being detected as unused if it is copied. */
@@ -1316,7 +1317,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
DECL_IGNORED_P (decl) = 1;
}
- if (sym->attr.dimension)
+ if (sym->attr.dimension || sym->attr.codimension)
{
/* Create variables to hold the non-constant bits of array info. */
gfc_build_qualified_array (decl, sym);
@@ -3435,7 +3436,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
if (sym->assoc)
continue;
- if (sym->attr.dimension)
+ if (sym->attr.dimension || sym->attr.codimension)
{
switch (sym->as->type)
{
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 9874d16..24fdcf3 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1683,9 +1683,10 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
stride = gfc_index_one_node;
else
stride = NULL_TREE;
- for (n = 0; n < dimen; n++)
+ for (n = 0; n < dimen + codimen; n++)
{
- GFC_TYPE_ARRAY_STRIDE (fat_type, n) = stride;
+ if (n < dimen)
+ GFC_TYPE_ARRAY_STRIDE (fat_type, n) = stride;
if (lbound)
lower = lbound[n];
@@ -1700,6 +1701,9 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
lower = NULL_TREE;
}
+ if (codimen && n == dimen + codimen - 1)
+ break;
+
upper = ubound[n];
if (upper != NULL_TREE)
{
@@ -1709,6 +1713,9 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
upper = NULL_TREE;
}
+ if (n >= dimen)
+ continue;
+
if (upper != NULL_TREE && lower != NULL_TREE && stride != NULL_TREE)
{
tmp = fold_build2_loc (input_location, MINUS_EXPR,