diff options
author | Daniel Kraft <d@domob.eu> | 2010-08-19 18:02:30 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2010-08-19 18:02:30 +0200 |
commit | 99d821c01cacbfdba524cb4d4d8ea066abd15d2b (patch) | |
tree | 5ec817ebbdbef30901290c6099ab8de10dea253a /gcc/fortran/trans-decl.c | |
parent | f1b62c9f96d31dac273e1dfa0e389e240b420c69 (diff) | |
download | gcc-99d821c01cacbfdba524cb4d4d8ea066abd15d2b.zip gcc-99d821c01cacbfdba524cb4d4d8ea066abd15d2b.tar.gz gcc-99d821c01cacbfdba524cb4d4d8ea066abd15d2b.tar.bz2 |
re PR fortran/29785 (Fortran 2003: POINTER Rank Remapping)
2010-08-19 Daniel Kraft <d@domob.eu>
PR fortran/29785
PR fortran/45016
* trans.h (struct gfc_se): New flag `byref_noassign'.
* trans-array.h (gfc_conv_shift_descriptor_lbound): New method.
(gfc_conv_array_extent_dim), (gfc_conv_descriptor_size): New methods.
* expr.c (gfc_check_pointer_assign): Allow bounds and rank remapping
and check for compile-time errors with those.
* trans-decl.c (trans_associate_var): Use new routine
`gfc_conv_shift_descriptor_lbound' instead of doing it manually.
* trans-array.c (gfc_conv_shift_descriptor_lbound): New method.
(gfc_conv_array_extent_dim), (gfc_conv_descriptor_size): New methods.
(gfc_array_init_size): Use new `gfc_conv_array_extent_dim'.
(gfc_conv_expr_descriptor): Handle new flag `byref_noassign'.
* trans-expr.c (gfc_trans_pointer_assignment): Handle bounds and
rank remapping for assignment.
2010-08-19 Daniel Kraft <d@domob.eu>
PR fortran/29785
PR fortran/45016
* gfortran.dg/pointer_assign_5.f90: Remove 'not implemented' error.
* gfortran.dg/pointer_remapping_1.f90: New test.
* gfortran.dg/pointer_remapping_2.f03: New test.
* gfortran.dg/pointer_remapping_3.f08: New test.
* gfortran.dg/pointer_remapping_4.f03: New test.
* gfortran.dg/pointer_remapping_5.f08: New test.
* gfortran.dg/pointer_remapping_6.f08: New test.
From-SVN: r163377
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f3e2950..ea39709 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3133,42 +3133,15 @@ trans_associate_var (gfc_symbol* sym, gfc_wrapped_block* block) descriptor to the one generated for the temporary. */ if (!sym->assoc->variable) { - tree offs; int dim; gfc_add_modify (&se.pre, desc, se.expr); /* The generated descriptor has lower bound zero (as array - temporary), shift bounds so we get lower bounds of 1 all the time. - The offset has to be corrected as well. - Because the ubound shift and offset depends on the lower bounds, we - first calculate those and set the lbound to one last. */ - - offs = gfc_conv_descriptor_offset_get (desc); - for (dim = 0; dim < e->rank; ++dim) - { - tree from, to; - tree stride; - - from = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim]); - to = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[dim]); - stride = gfc_conv_descriptor_stride_get (desc, gfc_rank_cst[dim]); - - tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, - gfc_index_one_node, from); - to = fold_build2 (PLUS_EXPR, gfc_array_index_type, to, tmp); - - tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, tmp, stride); - offs = fold_build2 (MINUS_EXPR, gfc_array_index_type, offs, tmp); - - gfc_conv_descriptor_ubound_set (&se.pre, desc, - gfc_rank_cst[dim], to); - } - gfc_conv_descriptor_offset_set (&se.pre, desc, offs); - + temporary), shift bounds so we get lower bounds of 1. */ for (dim = 0; dim < e->rank; ++dim) - gfc_conv_descriptor_lbound_set (&se.pre, desc, gfc_rank_cst[dim], - gfc_index_one_node); + gfc_conv_shift_descriptor_lbound (&se.pre, desc, + dim, gfc_index_one_node); } /* Done, register stuff as init / cleanup code. */ |