diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-04-11 17:50:47 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-04-11 17:50:47 +0200 |
commit | 155e5d5f559fc3639da157b4c3a7ee41f62f43cb (patch) | |
tree | 387fbb7b6688f4fd0d88a06fd23809e5f79095f5 /gcc/fortran/trans-array.c | |
parent | e6313a7840a9266bb5777cd29b86885b63b3b24f (diff) | |
download | gcc-155e5d5f559fc3639da157b4c3a7ee41f62f43cb.zip gcc-155e5d5f559fc3639da157b4c3a7ee41f62f43cb.tar.gz gcc-155e5d5f559fc3639da157b4c3a7ee41f62f43cb.tar.bz2 |
re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-04-11 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* simplify.c (simplify_bound_dim): Exit for
ucobound's last dimension unless -fcoarray=single.
* trans-array (gfc_conv_descriptor_size_1): Renamed from
gfc_conv_descriptor_size, made static, has now from_dim and
to_dim arguments.
(gfc_conv_descriptor_size): Call gfc_conv_descriptor_size.
(gfc_conv_descriptor_cosize): New function.
* trans-array.h (gfc_conv_descriptor_cosize): New prototype.
* trans-intrinsic.c (conv_intrinsic_cobound): Add input_location
and handle last codim of ucobound for when -fcoarray is not "single".
From-SVN: r172262
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 0046d0ac..f8e26b0 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -4055,17 +4055,17 @@ gfc_conv_array_extent_dim (tree lbound, tree ubound, tree* or_expr) /* For an array descriptor, get the total number of elements. This is just - the product of the extents along all dimensions. */ + the product of the extents along from_dim to to_dim. */ -tree -gfc_conv_descriptor_size (tree desc, int rank) +static tree +gfc_conv_descriptor_size_1 (tree desc, int from_dim, int to_dim) { tree res; int dim; res = gfc_index_one_node; - for (dim = 0; dim < rank; ++dim) + for (dim = from_dim; dim < to_dim; ++dim) { tree lbound; tree ubound; @@ -4083,6 +4083,24 @@ gfc_conv_descriptor_size (tree desc, int rank) } +/* Full size of an array. */ + +tree +gfc_conv_descriptor_size (tree desc, int rank) +{ + return gfc_conv_descriptor_size_1 (desc, 0, rank); +} + + +/* Size of a coarray for all dimensions but the last. */ + +tree +gfc_conv_descriptor_cosize (tree desc, int rank, int corank) +{ + return gfc_conv_descriptor_size_1 (desc, rank, rank + corank - 1); +} + + /* Helper function for marking a boolean expression tree as unlikely. */ static tree |