trans-array.c (gfc_trans_array_constructor_value): Use size_int for bounds of range...
authorRichard Guenther <rguenther@suse.de>
Wed, 4 May 2011 13:18:34 +0000 (13:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 4 May 2011 13:18:34 +0000 (13:18 +0000)
2011-05-04  Richard Guenther  <rguenther@suse.de>

* trans-array.c (gfc_trans_array_constructor_value): Use
size_int for bounds of range types.
(gfc_trans_array_constructor_value): Use size_type_node
for memcpy argument.
* trans-common.c (build_field): Use gfc_charlen_type_node
for lengths.
* trans-openmp.c (gfc_trans_omp_clauses): Do not pass NULL
as type to build_int_cst.
* trans-const.c (gfc_build_string_const): Use size_int
for bounds of range types.
(gfc_build_wide_string_const): Likewise.
* trans-stmt.c (gfc_trans_label_assign): Use gfc_charlen_type_node
for lengths.
(gfc_trans_character_select): Likewise.
(gfc_trans_character_select): Do not pass NULL
as type to build_int_cst.
(gfc_trans_character_select): Use size_int for bounds of range types.
* trans-io.c (gfc_build_io_library_fndecls): Likewise.
(add_case): Do not pass NULL as type to build_int_cst.
(transfer_expr): Likewise.
(transfer_array_desc): Likewise.
* trans-decl.c (gfc_add_assign_aux_vars): Use gfc_charlen_type_node
for lengths.
(gfc_trans_assign_aux_var): Likewise.
(create_main_function): Use size_int for bounds of range types.
* trans-intrinsic.c (gfc_conv_intrinsic_minmax_char): Do not pass
NULL as type to build_int_cst.
(gfc_conv_intrinsic_spacing): Likewise.
(gfc_conv_intrinsic_rrspacing): Likewise.
(gfc_conv_intrinsic_len): Use gfc_charlen_type_node for lengths.

From-SVN: r173374

gcc/fortran/ChangeLog
gcc/fortran/trans-array.c
gcc/fortran/trans-common.c
gcc/fortran/trans-const.c
gcc/fortran/trans-decl.c
gcc/fortran/trans-intrinsic.c
gcc/fortran/trans-io.c
gcc/fortran/trans-openmp.c
gcc/fortran/trans-stmt.c

index f5e8ba6109682a86fc2795b0ad739cd049d42359..ce33b0495038f97a430396f2fc27e22fa9c3fb79 100644 (file)
@@ -1,3 +1,36 @@
+2011-05-04  Richard Guenther  <rguenther@suse.de>
+
+       * trans-array.c (gfc_trans_array_constructor_value): Use
+       size_int for bounds of range types.
+       (gfc_trans_array_constructor_value): Use size_type_node
+       for memcpy argument.
+       * trans-common.c (build_field): Use gfc_charlen_type_node
+       for lengths.
+       * trans-openmp.c (gfc_trans_omp_clauses): Do not pass NULL
+       as type to build_int_cst.
+       * trans-const.c (gfc_build_string_const): Use size_int
+       for bounds of range types.
+       (gfc_build_wide_string_const): Likewise.
+       * trans-stmt.c (gfc_trans_label_assign): Use gfc_charlen_type_node
+       for lengths.
+       (gfc_trans_character_select): Likewise.
+       (gfc_trans_character_select): Do not pass NULL
+       as type to build_int_cst.
+       (gfc_trans_character_select): Use size_int for bounds of range types.
+       * trans-io.c (gfc_build_io_library_fndecls): Likewise.
+       (add_case): Do not pass NULL as type to build_int_cst.
+       (transfer_expr): Likewise.
+       (transfer_array_desc): Likewise.
+       * trans-decl.c (gfc_add_assign_aux_vars): Use gfc_charlen_type_node
+       for lengths.
+       (gfc_trans_assign_aux_var): Likewise.
+       (create_main_function): Use size_int for bounds of range types.
+       * trans-intrinsic.c (gfc_conv_intrinsic_minmax_char): Do not pass
+       NULL as type to build_int_cst.
+       (gfc_conv_intrinsic_spacing): Likewise.
+       (gfc_conv_intrinsic_rrspacing): Likewise.
+       (gfc_conv_intrinsic_len): Use gfc_charlen_type_node for lengths.
+
 2011-05-04  Richard Guenther  <rguenther@suse.de>
 
        * trans-types.c (gfc_get_array_type_bounds): Remove zero notrunc
index 20138e2603741230946cbcc3ab091a59ccc50d3b..a7e5f812f89fc58d5ff62e20c0377979f728629d 100644 (file)
@@ -1364,7 +1364,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
                  p = gfc_constructor_next (p);
                }
 
-             bound = build_int_cst (NULL_TREE, n - 1);
+             bound = size_int (n - 1);
               /* Create an array type to hold them.  */
              tmptype = build_range_type (gfc_array_index_type,
                                          gfc_index_zero_node, bound);
@@ -1390,7 +1390,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
              init = gfc_build_addr_expr (NULL_TREE, init);
 
              size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type));
-             bound = build_int_cst (NULL_TREE, n * size);
+             bound = build_int_cst (size_type_node, n * size);
              tmp = build_call_expr_loc (input_location,
                                     built_in_decls[BUILT_IN_MEMCPY], 3,
                                     tmp, init, bound);
index b6318b707ca60a0a35db442edcba28b024566df7..c289bbe3dafdb7ef0cfd36ef2e7f3317b184c636 100644 (file)
@@ -309,7 +309,7 @@ build_field (segment_info *h, tree union_type, record_layout_info rli)
       addr = gfc_create_var_np (pvoid_type_node, h->sym->name);
       TREE_STATIC (len) = 1;
       TREE_STATIC (addr) = 1;
-      DECL_INITIAL (len) = build_int_cst (NULL_TREE, -2);
+      DECL_INITIAL (len) = build_int_cst (gfc_charlen_type_node, -2);
       gfc_set_decl_location (len, &h->sym->declared_at);
       gfc_set_decl_location (addr, &h->sym->declared_at);
       GFC_DECL_STRING_LEN (field) = pushdecl_top_level (len);
index 30739d8305f4a080be656786a06e9279e9582b92..5fbe765c4938ac52b8e379a65dbaa2f7827df0cd 100644 (file)
@@ -75,11 +75,11 @@ gfc_build_string_const (int length, const char *s)
   tree len;
 
   str = build_string (length, s);
-  len = build_int_cst (NULL_TREE, length);
+  len = size_int (length);
   TREE_TYPE (str) =
     build_array_type (gfc_character1_type_node,
                      build_range_type (gfc_charlen_type_node,
-                                       integer_one_node, len));
+                                       size_one_node, len));
   return str;
 }
 
@@ -104,11 +104,11 @@ gfc_build_wide_string_const (int kind, int length, const gfc_char_t *string)
   str = build_string (size, s);
   free (s);
 
-  len = build_int_cst (NULL_TREE, length);
+  len = size_int (length);
   TREE_TYPE (str) =
     build_array_type (gfc_get_char_type (kind),
                      build_range_type (gfc_charlen_type_node,
-                                       integer_one_node, len));
+                                       size_one_node, len));
   return str;
 }
 
index f80c9dbcfa54d2b440a5eb24477ac3f09caef046..a5527d5f3c0ad178c30b2e37fcbb3db086553f31 100644 (file)
@@ -1096,7 +1096,7 @@ gfc_add_assign_aux_vars (gfc_symbol * sym)
       target label's address. Otherwise, value is the length of a format string
       and ASSIGN_ADDR is its address.  */
   if (TREE_STATIC (length))
-    DECL_INITIAL (length) = build_int_cst (NULL_TREE, -2);
+    DECL_INITIAL (length) = build_int_cst (gfc_charlen_type_node, -2);
   else
     gfc_defer_symbol_init (sym);
 
@@ -3130,7 +3130,7 @@ gfc_trans_assign_aux_var (gfc_symbol * sym, gfc_wrapped_block * block)
   /* Set the initial value to length. See the comments in
      function gfc_add_assign_aux_vars in this file.  */
   gfc_add_modify (&init, GFC_DECL_STRING_LEN (sym->backend_decl),
-                 build_int_cst (NULL_TREE, -2));
+                 build_int_cst (gfc_charlen_type_node, -2));
 
   gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE);
 }
@@ -4639,7 +4639,7 @@ create_main_function (tree fndecl)
                                            gfc_option.flag_range_check));
 
     array_type = build_array_type (integer_type_node,
-                      build_index_type (build_int_cst (NULL_TREE, 7)));
+                                  build_index_type (size_int (7)));
     array = build_constructor (array_type, v);
     TREE_CONSTANT (array) = 1;
     TREE_STATIC (array) = 1;
index 10dadf7555aef76ceb0fa6dba1fc7c77b5ed59d1..fd538bf76d496e7336ad3a64c85d12dd6868ba34 100644 (file)
@@ -2213,8 +2213,8 @@ gfc_conv_intrinsic_minmax_char (gfc_se * se, gfc_expr * expr, int op)
   args[0] = gfc_build_addr_expr (NULL_TREE, len);
   var = gfc_create_var (gfc_get_pchar_type (expr->ts.kind), "pstr");
   args[1] = gfc_build_addr_expr (ppvoid_type_node, var);
-  args[2] = build_int_cst (NULL_TREE, op);
-  args[3] = build_int_cst (NULL_TREE, nargs / 2);
+  args[2] = build_int_cst (integer_type_node, op);
+  args[3] = build_int_cst (integer_type_node, nargs / 2);
 
   if (expr->ts.kind == 1)
     function = gfor_fndecl_string_minmax;
@@ -4420,7 +4420,7 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr)
   switch (arg->expr_type)
     {
     case EXPR_CONSTANT:
-      len = build_int_cst (NULL_TREE, arg->value.character.length);
+      len = build_int_cst (gfc_charlen_type_node, arg->value.character.length);
       break;
 
     case EXPR_ARRAY:
@@ -4766,8 +4766,8 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr)
   stmtblock_t block;
 
   k = gfc_validate_kind (BT_REAL, expr->ts.kind, false);
-  prec = build_int_cst (NULL_TREE, gfc_real_kinds[k].digits);
-  emin = build_int_cst (NULL_TREE, gfc_real_kinds[k].min_exponent - 1);
+  prec = build_int_cst (integer_type_node, gfc_real_kinds[k].digits);
+  emin = build_int_cst (integer_type_node, gfc_real_kinds[k].min_exponent - 1);
   tiny = gfc_conv_mpfr_to_tree (gfc_real_kinds[k].tiny, expr->ts.kind, 0);
 
   frexp = gfc_builtin_decl_for_float_kind (BUILT_IN_FREXP, expr->ts.kind);
@@ -4850,7 +4850,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr)
   gfc_add_expr_to_block (&block, tmp);
 
   tmp = fold_build2_loc (input_location, MINUS_EXPR, integer_type_node,
-                        build_int_cst (NULL_TREE, prec), e);
+                        build_int_cst (integer_type_node, prec), e);
   tmp = build_call_expr_loc (input_location, scalbn, 2, x, tmp);
   gfc_add_modify (&block, x, tmp);
   stmt = gfc_finish_block (&block);
index 8021bc672be35386529b50e986ae93e747d98a92..07df5d8d8879f61412c635613f4f7b8021d25a52 100644 (file)
@@ -295,7 +295,7 @@ gfc_build_io_library_fndecls (void)
   types[IOPARM_type_pchar] = pchar_type_node;
   pad_size = 16 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (pchar_type_node));
   pad_size += 32 * TREE_INT_CST_LOW (TYPE_SIZE_UNIT (integer_type_node));
-  pad_idx = build_index_type (build_int_cst (NULL_TREE, pad_size - 1));
+  pad_idx = build_index_type (size_int (pad_size - 1));
   types[IOPARM_type_pad] = build_array_type (char_type_node, pad_idx);
 
   /* pad actually contains pointers and integers so it needs to have an
@@ -826,7 +826,7 @@ add_case (int label_value, gfc_st_label * label, stmtblock_t * body)
   if (label == NULL)
     return;                    /* No label, no case */
 
-  value = build_int_cst (NULL_TREE, label_value);
+  value = build_int_cst (integer_type_node, label_value);
 
   /* Make a backend label for this case.  */
   tmp = gfc_build_label_decl (NULL_TREE);
@@ -2051,7 +2051,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
   switch (ts->type)
     {
     case BT_INTEGER:
-      arg2 = build_int_cst (NULL_TREE, kind);
+      arg2 = build_int_cst (integer_type_node, kind);
       if (last_dt == READ)
        function = iocall[IOCALL_X_INTEGER];
       else
@@ -2060,7 +2060,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
       break;
 
     case BT_REAL:
-      arg2 = build_int_cst (NULL_TREE, kind);
+      arg2 = build_int_cst (integer_type_node, kind);
       if (last_dt == READ)
        {
          if (gfc_real16_is_float128 && ts->kind == 16)
@@ -2079,7 +2079,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
       break;
 
     case BT_COMPLEX:
-      arg2 = build_int_cst (NULL_TREE, kind);
+      arg2 = build_int_cst (integer_type_node, kind);
       if (last_dt == READ)
        {
          if (gfc_real16_is_float128 && ts->kind == 16)
@@ -2098,7 +2098,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
       break;
 
     case BT_LOGICAL:
-      arg2 = build_int_cst (NULL_TREE, kind);
+      arg2 = build_int_cst (integer_type_node, kind);
       if (last_dt == READ)
        function = iocall[IOCALL_X_LOGICAL];
       else
@@ -2119,7 +2119,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
              arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
              arg2 = fold_convert (gfc_charlen_type_node, arg2);
            }
-         arg3 = build_int_cst (NULL_TREE, kind);
+         arg3 = build_int_cst (integer_type_node, kind);
          if (last_dt == READ)
            function = iocall[IOCALL_X_CHARACTER_WIDE];
          else
@@ -2203,9 +2203,9 @@ transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr)
   if (ts->type == BT_CHARACTER)
     charlen_arg = se->string_length;
   else
-    charlen_arg = build_int_cst (NULL_TREE, 0);
+    charlen_arg = build_int_cst (gfc_charlen_type_node, 0);
 
-  kind_arg = build_int_cst (NULL_TREE, ts->kind);
+  kind_arg = build_int_cst (integer_type_node, ts->kind);
 
   tmp = gfc_build_addr_expr (NULL_TREE, dt_parm);
   if (last_dt == READ)
index 625daebe8b293ed05ddb3855bbe3882c3ecfc267..75548897a08bcd1aa1be81ac39eb31fc6edad7c6 100644 (file)
@@ -948,7 +948,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
   if (clauses->collapse)
     {
       c = build_omp_clause (where.lb->location, OMP_CLAUSE_COLLAPSE);
-      OMP_CLAUSE_COLLAPSE_EXPR (c) = build_int_cst (NULL, clauses->collapse);
+      OMP_CLAUSE_COLLAPSE_EXPR (c)
+       = build_int_cst (integer_type_node, clauses->collapse);
       omp_clauses = gfc_trans_add_clause (c, omp_clauses);
     }
 
index 7e08e8dd07bac8072573f4f24e44de59f0fa8faa..9147d889ac601847a692456f0f5fa35d636a74f2 100644 (file)
@@ -119,7 +119,7 @@ gfc_trans_label_assign (gfc_code * code)
       gfc_expr *format = code->label1->format;
 
       label_len = format->value.character.length;
-      len_tree = build_int_cst (NULL_TREE, label_len);
+      len_tree = build_int_cst (gfc_charlen_type_node, label_len);
       label_tree = gfc_build_wide_string_const (format->ts.kind, label_len + 1,
                                                format->value.character.string);
       label_tree = gfc_build_addr_expr (pvoid_type_node, label_tree);
@@ -2131,7 +2131,8 @@ gfc_trans_character_select (gfc_code *code)
          tmp = fold_build3_loc (input_location, CASE_LABEL_EXPR,
                                 void_type_node,
                                 (d->low == NULL && d->high == NULL)
-                                ? NULL : build_int_cst (NULL_TREE, d->n),
+                                ? NULL : build_int_cst (integer_type_node,
+                                                        d->n),
                                 NULL, label);
           gfc_add_expr_to_block (&body, tmp);
         }
@@ -2185,7 +2186,7 @@ gfc_trans_character_select (gfc_code *code)
     }
 
   type = build_array_type (select_struct[k],
-                          build_index_type (build_int_cst (NULL_TREE, n-1)));
+                          build_index_type (size_int (n-1)));
 
   init = build_constructor (type, inits);
   TREE_CONSTANT (init) = 1;
@@ -2209,7 +2210,8 @@ gfc_trans_character_select (gfc_code *code)
     gcc_unreachable ();
 
   tmp = build_call_expr_loc (input_location,
-                        fndecl, 4, init, build_int_cst (NULL_TREE, n),
+                        fndecl, 4, init,
+                        build_int_cst (gfc_charlen_type_node, n),
                         expr1se.expr, expr1se.string_length);
   case_num = gfc_create_var (integer_type_node, "case_num");
   gfc_add_modify (&block, case_num, tmp);