re PR fortran/22244 (dimension information is lost for multi-dimension array)
authorJakub Jelinek <jakub@redhat.com>
Tue, 28 Aug 2007 16:08:57 +0000 (18:08 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 28 Aug 2007 16:08:57 +0000 (18:08 +0200)
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

gcc/fortran/ChangeLog
gcc/fortran/Make-lang.in
gcc/fortran/trans-types.c

index e2ec1af83e909416b5b88f4f7f8e7ffbb93bf2b2..dffd31ea69aefbe7d08745039373f0e6b937c064 100644 (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.
index 4a9590a2caef82c5a73c17b6113137c43c8a35e5..30320a848100d01817fffb8b30c938d7496b554c 100644 (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
index e1cac5de9df3e96abeefad5e58726a0f8eae9381..b7c9c53bf215c48806b3243cce642ea15acdc2a2 100644 (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"
 \f
 
 #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