OSDN Git Service

* dwarf2out.c (descr_info_loc): Handle VAR_DECL.
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Aug 2008 18:53:33 +0000 (18:53 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Aug 2008 18:53:33 +0000 (18:53 +0000)
* trans.h (struct lang_type): Add span.
(GFC_TYPE_ARRAY_SPAN): Define.
* trans-decl.c (gfc_get_symbol_decl): For subref array pointers,
copy TREE_STATIC from decl to span instead of setting it
unconditionally, set DECL_ARTIFICIAL, fix type of initializer
and set GFC_TYPE_ARRAY_SPAN on decl's type.
* trans-types.c (gfc_get_array_descr_info): If
GFC_TYPE_ARRAY_SPAN is non-NULL, use it as element size.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139782 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c
gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/fortran/trans-types.c
gcc/fortran/trans.h

index 09d5e1e..1158c2f 100644 (file)
@@ -1,5 +1,7 @@
 2008-08-29  Jakub Jelinek  <jakub@redhat.com>
 
+       * dwarf2out.c (descr_info_loc): Handle VAR_DECL.
+
        * dwarf2out.c (gen_const_die): New function.
        (size_of_die, value_format, output_die): Output larger
        dw_val_class_vec using DW_FORM_block2 or DW_FORM_block4.
index deddf7e..22c3624 100644 (file)
@@ -12854,6 +12854,8 @@ descr_info_loc (tree val, tree base_decl)
     {
     CASE_CONVERT:
       return descr_info_loc (TREE_OPERAND (val, 0), base_decl);
+    case VAR_DECL:
+      return loc_descriptor_from_tree_1 (val, 0);
     case INTEGER_CST:
       if (host_integerp (val, 0))
        return int_loc_descriptor (tree_low_cst (val, 0));
index b509e57..196626c 100644 (file)
@@ -1,5 +1,14 @@
 2008-08-29  Jakub Jelinek  <jakub@redhat.com>
 
+       * trans.h (struct lang_type): Add span.
+       (GFC_TYPE_ARRAY_SPAN): Define.
+       * trans-decl.c (gfc_get_symbol_decl): For subref array pointers,
+       copy TREE_STATIC from decl to span instead of setting it
+       unconditionally, set DECL_ARTIFICIAL, fix type of initializer
+       and set GFC_TYPE_ARRAY_SPAN on decl's type.
+       * trans-types.c (gfc_get_array_descr_info): If
+       GFC_TYPE_ARRAY_SPAN is non-NULL, use it as element size.
+
        * trans-decl.c (check_constant_initializer,
        gfc_emit_parameter_debug_info): New functions.
        (gfc_generate_module_vars, gfc_generate_function_code): Emit
index c6128a6..72f5973 100644 (file)
@@ -1105,10 +1105,12 @@ gfc_get_symbol_decl (gfc_symbol * sym)
       span = build_decl (VAR_DECL, create_tmp_var_name ("span"),
                         gfc_array_index_type);
       gfc_finish_var_decl (span, sym);
-      TREE_STATIC (span) = 1;
-      DECL_INITIAL (span) = build_int_cst (NULL_TREE, 0);
+      TREE_STATIC (span) = TREE_STATIC (decl);
+      DECL_ARTIFICIAL (span) = 1;
+      DECL_INITIAL (span) = build_int_cst (gfc_array_index_type, 0);
 
       GFC_DECL_SPAN (decl) = span;
+      GFC_TYPE_ARRAY_SPAN (TREE_TYPE (decl)) = span;
     }
 
   sym->backend_decl = decl;
index dbda199..8178ae3 100644 (file)
@@ -2289,7 +2289,10 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
   else
     info->base_decl = base_decl = build_decl (VAR_DECL, NULL_TREE, ptype);
 
-  elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype));
+  if (GFC_TYPE_ARRAY_SPAN (type))
+    elem_size = GFC_TYPE_ARRAY_SPAN (type);
+  else
+    elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype));
   field = TYPE_FIELDS (TYPE_MAIN_VARIANT (type));
   data_off = byte_position (field);
   field = TREE_CHAIN (field);
index 290c92b..5d729ea 100644 (file)
@@ -615,6 +615,7 @@ struct lang_type            GTY(())
   tree offset;
   tree dtype;
   tree dataptr_type;
+  tree span;
 };
 
 struct lang_decl               GTY(())
@@ -667,6 +668,7 @@ struct lang_decl            GTY(())
 #define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype)
 #define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \
   (TYPE_LANG_SPECIFIC(node)->dataptr_type)
+#define GFC_TYPE_ARRAY_SPAN(node) (TYPE_LANG_SPECIFIC(node)->span)
 
 /* Build an expression with void type.  */
 #define build1_v(code, arg) fold_build1(code, void_type_node, arg)