re PR fortran/22244 (dimension information is lost for multi-dimension array)

PR fortran/22244
	* Make-lang.in (fortran/trans-types.o): Depend on $(FLAGS_H).
	* trans-types.c: Include flags.h.
	(gfc_get_nodesc_array_type): Add TYPE_DECL TYPE_NAME with
	correct bounds and dimensions for packed arrays.

From-SVN: r127864
This commit is contained in:
Jakub Jelinek 2007-08-28 18:08:57 +02:00 committed by Jakub Jelinek
parent 92d0af977f
commit 08789087fc
3 changed files with 29 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2007-08-28 Jakub Jelinek <jakub@redhat.com>
PR fortran/22244
* Make-lang.in (fortran/trans-types.o): Depend on $(FLAGS_H).
* trans-types.c: Include flags.h.
(gfc_get_nodesc_array_type): Add TYPE_DECL TYPE_NAME with
correct bounds and dimensions for packed arrays.
2007-08-27 Tobias Burnus <burnus@net-b.de>
* simplify.c (gfc_simplify_lgamma): Fix mpfr_lgamma call.

View File

@ -311,7 +311,7 @@ fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
$(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \
$(TREE_DUMP_H)
fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
$(REAL_H) toplev.h $(TARGET_H)
$(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H)
fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h

View File

@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "trans-types.h"
#include "trans-const.h"
#include "real.h"
#include "flags.h"
#if (GFC_MAX_DIMENSIONS < 10)
@ -1232,7 +1233,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed)
{
/* Fill in the stride and bound components of the type. */
if (known_stride)
tmp = gfc_conv_mpz_to_tree (stride, gfc_index_integer_kind);
tmp = gfc_conv_mpz_to_tree (stride, gfc_index_integer_kind);
else
tmp = NULL_TREE;
GFC_TYPE_ARRAY_STRIDE (type, n) = tmp;
@ -1330,6 +1331,24 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed)
mpz_clear (stride);
mpz_clear (delta);
/* In debug info represent packed arrays as multi-dimensional
if they have rank > 1 and with proper bounds, instead of flat
arrays. */
if (known_stride && write_symbols != NO_DEBUG)
{
tree gtype = etype, rtype, type_decl;
for (n = as->rank - 1; n >= 0; n--)
{
rtype = build_range_type (gfc_array_index_type,
GFC_TYPE_ARRAY_LBOUND (type, n),
GFC_TYPE_ARRAY_UBOUND (type, n));
gtype = build_array_type (gtype, rtype);
}
TYPE_NAME (type) = type_decl = build_decl (TYPE_DECL, NULL, gtype);
DECL_ORIGINAL_TYPE (type_decl) = gtype;
}
if (packed != PACKED_STATIC || !known_stride)
{
/* For dummy arrays and automatic (heap allocated) arrays we