]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use HOST_SIZE_T_PRINT_* and HOST_WIDE_INT_T_PRINT_* some more
authorJakub Jelinek <jakub@redhat.com>
Sat, 10 Feb 2024 10:26:26 +0000 (11:26 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 10 Feb 2024 10:26:26 +0000 (11:26 +0100)
I went through suspicios %l in format strings of *printf family functions
combined with casts to (long) or (unsigned long) and tried to find out the
types of the original expressions that were cast.
Quite a few had size_t type, so I've used the new HOST_SIZE_T_PRINT_*
macros together with cast to fmt_size_t for those, and then there were
quite a few HOST_WIDE_INTs cast to long, used HOST_WIDE_INT_PRINT_* for
those without casts.  There was one case of a weird unsigned int variable
used with %lu and (long) cast too.

2024-02-10  Jakub Jelinek  <jakub@redhat.com>

gcc/
* ipa-icf.cc (sem_item_optimizer::process_cong_reduction,
sem_item_optimizer::dump_cong_classes): Use HOST_SIZE_T_PRINT_UNSIGNED
and casts to fmt_size_t instead of "%lu" and casts to unsigned long.
* tree.cc (print_debug_expr_statistics): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.
(print_value_expr_statistics, print_type_hash_statistics): Likewise.
* dwarf2out.cc (output_macinfo_op): Use HOST_WIDE_INT_PRINT_UNSIGNED
instead of "%lu" and casts to unsigned long.
* gcov-dump.cc (dump_gcov_file): Use %u instead of %lu and casts to
unsigned long.
* tree-ssa-dom.cc (htab_statistics): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.
* cfgexpand.cc (dump_stack_var_partition): Use
HOST_SIZE_T_PRINT_UNSIGNED and casts to fmt_size_t instead of "%lu"
and casts to unsigned long.
* gengtype.cc (adjust_field_rtx_def): Likewise.
* tree-into-ssa.cc (htab_statistics): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.
* postreload-gcse.cc (dump_hash_table): Likewise.
* ggc-page.cc (alloc_page): Use HOST_SIZE_T_PRINT_UNSIGNED
and casts to fmt_size_t instead of "%lu" and casts to unsigned long.
(ggc_internal_alloc, ggc_free): Likewise.
* genpreds.cc (write_lookup_constraint_1): Likewise.
(write_insn_constraint_len): Likewise.
* tree-dfa.cc (dump_dfa_stats): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.
* varasm.cc (output_constant_pool_contents): Use
HOST_WIDE_INT_PRINT_DEC instead of "%ld" and casts to long.
* var-tracking.cc (dump_var): Likewise.
gcc/c-family/
* c-ada-spec.cc (dump_template_types): Use HOST_SIZE_T_PRINT_UNSIGNED
and casts to fmt_size_t instead of "%lu" and casts to unsigned long.
gcc/c/
* c-decl.cc (get_parm_array_spec): Use HOST_WIDE_INT_PRINT_UNSIGNED
instead of "%lu" and casts to unsigned long or unsigned long long.
gcc/cp/
* tree.cc (debug_binfo): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld"
and casts to long.
* pt.cc (print_template_statistics): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.
* class.cc (dump_class_hierarchy_1): Use HOST_WIDE_INT_PRINT_UNSIGNED
instead of "%lu" and casts to unsigned long.  For TYPE_ALIGN, use
%u instead of %lu and drop casts to unsigned long.
* parser.cc (cp_lexer_peek_nth_token): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.
gcc/fortran/
* trans-common.cc (build_common_decl): Use %wu instead of %lu and
casts to unsigned long.
* resolve.cc (resolve_ordinary_assign): Use %wd instead of %ld and
casts to long.
* array.cc (gfc_resolve_character_array_constructor): Likewise.
* data.cc (create_character_initializer): Likewise.
gcc/jit/
* jit-playback.cc (new_bitcast): Use HOST_WIDE_INT_PRINT_DEC instead
of "%ld" and casts to long.
gcc/lto/
* lto-common.cc (print_lto_report_1): Use HOST_SIZE_T_PRINT_DEC
and casts to fmt_size_t instead of "%ld" and casts to long.  Use
%d instead of %ld and casts to long for searches and collisions.

26 files changed:
gcc/c-family/c-ada-spec.cc
gcc/c/c-decl.cc
gcc/cfgexpand.cc
gcc/cp/class.cc
gcc/cp/parser.cc
gcc/cp/pt.cc
gcc/cp/tree.cc
gcc/dwarf2out.cc
gcc/fortran/array.cc
gcc/fortran/data.cc
gcc/fortran/resolve.cc
gcc/fortran/trans-common.cc
gcc/gcov-dump.cc
gcc/gengtype.cc
gcc/genpreds.cc
gcc/ggc-page.cc
gcc/ipa-icf.cc
gcc/jit/jit-playback.cc
gcc/lto/lto-common.cc
gcc/postreload-gcse.cc
gcc/tree-dfa.cc
gcc/tree-into-ssa.cc
gcc/tree-ssa-dom.cc
gcc/tree.cc
gcc/var-tracking.cc
gcc/varasm.cc

index 4b245ed69754baf29d91ca080ffaf1633dd08e6f..e56ef10f443a360974fb9ced24e55a2d0f6d7e62 100644 (file)
@@ -1852,7 +1852,8 @@ dump_template_types (pretty_printer *buffer, tree types, int spc)
       if (!dump_ada_node (buffer, elem, NULL_TREE, spc, false, true))
        {
          pp_string (buffer, "unknown");
-         pp_scalar (buffer, "%lu", (unsigned long) TREE_HASH (elem));
+         pp_scalar (buffer, HOST_SIZE_T_PRINT_UNSIGNED,
+                    (fmt_size_t) TREE_HASH (elem));
        }
     }
 }
index fe20bc21c926f9353c774a1be5aa64fb94018c64..c747abe9f4effdf12402f6c730b208714e0434bb 100644 (file)
@@ -6236,7 +6236,7 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs)
                     index.  */
                  HOST_WIDE_INT n = tree_to_shwi (max) + 1;
                  char buf[40];
-                 sprintf (buf, "%lu", (unsigned long)n);
+                 sprintf (buf, HOST_WIDE_INT_PRINT_UNSIGNED, n);
                  spec += buf;
                }
              continue;
@@ -6309,7 +6309,7 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs)
 
          char buf[40];
          unsigned HOST_WIDE_INT n = tree_to_uhwi (nelts);
-         sprintf (buf, "%llu", (unsigned long long)n);
+         sprintf (buf, HOST_WIDE_INT_PRINT_UNSIGNED, n);
          spec += buf;
          break;
        }
index 027e2844a7eabeaf74e2d2ae6d316f087a3c6c41..d36dfc842e15f363a238c33c0cb86691f7fdef21 100644 (file)
@@ -1024,7 +1024,8 @@ dump_stack_var_partition (void)
       if (stack_vars[i].representative != i)
        continue;
 
-      fprintf (dump_file, "Partition %lu: size ", (unsigned long) i);
+      fprintf (dump_file, "Partition " HOST_SIZE_T_PRINT_UNSIGNED ": size ",
+              (fmt_size_t) i);
       print_dec (stack_vars[i].size, dump_file);
       fprintf (dump_file, " align %u\n", stack_vars[i].alignb);
 
index 556943c3e55122fd0af78bdece61232bce0f9524..5f258729940b6ab062f40b1e6ad2443b9050c6e7 100644 (file)
@@ -9585,14 +9585,14 @@ static void
 dump_class_hierarchy_1 (FILE *stream, dump_flags_t flags, tree t)
 {
   fprintf (stream, "Class %s\n", type_as_string (t, TFF_PLAIN_IDENTIFIER));
-  fprintf (stream, "   size=%lu align=%lu\n",
-          (unsigned long)(tree_to_shwi (TYPE_SIZE (t)) / BITS_PER_UNIT),
-          (unsigned long)(TYPE_ALIGN (t) / BITS_PER_UNIT));
+  fprintf (stream, "   size=" HOST_WIDE_INT_PRINT_UNSIGNED " align=%u\n",
+          tree_to_shwi (TYPE_SIZE (t)) / BITS_PER_UNIT,
+          TYPE_ALIGN (t) / BITS_PER_UNIT);
   if (tree as_base = CLASSTYPE_AS_BASE (t))
-    fprintf (stream, "   base size=%lu base align=%lu\n",
-            (unsigned long)(tree_to_shwi (TYPE_SIZE (as_base))
-                            / BITS_PER_UNIT),
-            (unsigned long)(TYPE_ALIGN (as_base) / BITS_PER_UNIT));
+    fprintf (stream, "   base size=" HOST_WIDE_INT_PRINT_UNSIGNED
+            " base align=%u\n",
+            tree_to_shwi (TYPE_SIZE (as_base)) / BITS_PER_UNIT,
+            TYPE_ALIGN (as_base) / BITS_PER_UNIT);
   dump_class_hierarchy_r (stream, flags, TYPE_BINFO (t), TYPE_BINFO (t), 0);
   fprintf (stream, "\n");
 }
index 09ecfa23b5dd6cfde28b8b97cfee93aa88e9cebd..54f70133778ee32546731164ddca0ab476091600 100644 (file)
@@ -1310,7 +1310,8 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
 
   if (cp_lexer_debugging_p (lexer))
     fprintf (cp_lexer_debug_stream,
-            "cp_lexer: peeking ahead %ld at token: ", (long)n);
+            "cp_lexer: peeking ahead " HOST_SIZE_T_PRINT_DEC " at token: ",
+            (fmt_size_t) n);
 
   --n;
   token = lexer->next_token;
index 9c225c095c8154f6c151e383e88f03c86fb4b327..475f2181cc4909efcc107f4e14c55eaa445d8885 100644 (file)
@@ -31593,13 +31593,15 @@ init_template_processing (void)
 void
 print_template_statistics (void)
 {
-  fprintf (stderr, "decl_specializations: size %ld, %ld elements, "
-          "%f collisions\n", (long) decl_specializations->size (),
-          (long) decl_specializations->elements (),
+  fprintf (stderr, "decl_specializations: size " HOST_SIZE_T_PRINT_DEC ", "
+          HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n",
+          (fmt_size_t) decl_specializations->size (),
+          (fmt_size_t) decl_specializations->elements (),
           decl_specializations->collisions ());
-  fprintf (stderr, "type_specializations: size %ld, %ld elements, "
-          "%f collisions\n", (long) type_specializations->size (),
-          (long) type_specializations->elements (),
+  fprintf (stderr, "type_specializations: size " HOST_SIZE_T_PRINT_DEC ", "
+          HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n",
+          (fmt_size_t) type_specializations->size (),
+          (fmt_size_t) type_specializations->elements (),
           type_specializations->collisions ());
 }
 
index 50dc345ec9afd8a3180d9507b35aaa7717b03c22..ad312710f68758970149f0b0fea64eff94d16fbb 100644 (file)
@@ -2253,9 +2253,10 @@ debug_binfo (tree elem)
   while (virtuals)
     {
       tree fndecl = TREE_VALUE (virtuals);
-      fprintf (stderr, "%s [%ld =? %ld]\n",
+      fprintf (stderr, "%s [" HOST_WIDE_INT_PRINT_DEC " =? "
+                      HOST_WIDE_INT_PRINT_DEC "]\n",
               IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)),
-              (long) n, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl)));
+              n, TREE_INT_CST_LOW (DECL_VINDEX (fndecl)));
       ++n;
       virtuals = TREE_CHAIN (virtuals);
     }
index 4b09c353365e81a7ece103ff0b5b6ae58aa5ef2a..5d64100b95c56ac9b76718fa51a649fe0f722144 100644 (file)
@@ -28987,8 +28987,9 @@ output_macinfo_op (macinfo_entry *ref)
       file_num = maybe_emit_file (fd);
       dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
       dw2_asm_output_data_uleb128 (ref->lineno,
-                                  "Included from line number %lu", 
-                                  (unsigned long) ref->lineno);
+                                  "Included from line number "
+                                  HOST_WIDE_INT_PRINT_UNSIGNED,
+                                  ref->lineno);
       dw2_asm_output_data_uleb128 (file_num, "file %s", ref->info);
       break;
     case DW_MACINFO_end_file:
@@ -29014,8 +29015,10 @@ output_macinfo_op (macinfo_entry *ref)
       dw2_asm_output_data (1, ref->code,
                           ref->code == DW_MACINFO_define
                           ? "Define macro" : "Undefine macro");
-      dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu", 
-                                  (unsigned long) ref->lineno);
+      dw2_asm_output_data_uleb128 (ref->lineno,
+                                  "At line number "
+                                  HOST_WIDE_INT_PRINT_UNSIGNED, 
+                                  ref->lineno);
       dw2_asm_output_nstring (ref->info, -1, "The macro");
       break;
     case DW_MACRO_define_strp:
@@ -29047,8 +29050,10 @@ output_macinfo_op (macinfo_entry *ref)
       gcc_assert (node
                  && (node->form == DW_FORM_strp
                      || node->form == dwarf_FORM (DW_FORM_strx)));
-      dw2_asm_output_data_uleb128 (ref->lineno, "At line number %lu",
-                                  (unsigned long) ref->lineno);
+      dw2_asm_output_data_uleb128 (ref->lineno,
+                                  "At line number "
+                                  HOST_WIDE_INT_PRINT_UNSIGNED,
+                                  ref->lineno);
       if (node->form == DW_FORM_strp)
         dw2_asm_output_offset (dwarf_offset_size, node->label,
                                debug_str_section, "The macro: \"%s\"",
index 81fa99d219fd0eeb92621028f15dca7578b382c1..3a6e3a7c95bcd4fb245fb54d5e7599f11d22861d 100644 (file)
@@ -2212,9 +2212,9 @@ got_charlen:
            found_length = current_length;
          else if (found_length != current_length)
            {
-             gfc_error ("Different CHARACTER lengths (%ld/%ld) in array"
-                        " constructor at %L", (long) found_length,
-                        (long) current_length, &p->expr->where);
+             gfc_error ("Different CHARACTER lengths (%wd/%wd) in array"
+                        " constructor at %L", found_length,
+                        current_length, &p->expr->where);
              return false;
            }
 
index deed2d3ca23c5347fe995f250ae77bd6a0b8cf96..70247490e47156e9c1b3e6a8b1b503d7a2f5434c 100644 (file)
@@ -209,8 +209,8 @@ create_character_initializer (gfc_expr *init, gfc_typespec *ts,
       else
        {
          gfc_warning_now (0, "Initialization string at %L was truncated to "
-                          "fit the variable (%ld/%ld)", &rvalue->where,
-                          (long) tlen, (long) len);
+                          "fit the variable (%wd/%wd)", &rvalue->where,
+                          tlen, len);
          len = tlen;
        }
     }
index 6148ed94fe133f244cc006a41c779320bb4ef6ee..44f89f6afb4f17bc8f3e280ead81ca8916ce1c45 100644 (file)
@@ -11291,8 +11291,8 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
       if (rlen && llen && rlen > llen)
        gfc_warning_now (OPT_Wcharacter_truncation,
                         "CHARACTER expression will be truncated "
-                        "in assignment (%ld/%ld) at %L",
-                        (long) llen, (long) rlen, &code->loc);
+                        "in assignment (%wd/%wd) at %L",
+                        llen, rlen, &code->loc);
     }
 
   /* Ensure that a vector index expression for the lvalue is evaluated
index 4fc9652a7142c9a2c3fd23773e1306789a0aaca8..5f44e7bd663df3b63ba38d9e31618382785634ae 100644 (file)
@@ -409,10 +409,10 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
       if (!tree_int_cst_equal (DECL_SIZE_UNIT (decl), size)
          && strcmp (com->name, BLANK_COMMON_NAME))
        gfc_warning (0, "Named COMMON block %qs at %L shall be of the "
-                    "same size as elsewhere (%lu vs %lu bytes)", com->name,
+                    "same size as elsewhere (%wu vs %wu bytes)", com->name,
                     &com->where,
-                    (unsigned long) TREE_INT_CST_LOW (size),
-                    (unsigned long) TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl)));
+                    TREE_INT_CST_LOW (size),
+                    TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl)));
 
       if (tree_int_cst_lt (DECL_SIZE_UNIT (decl), size))
        {
index 167b6f508f6bfff061b60a5cc7f3ef03f4a740ee..2ff352bc766ae76bd31b5c2c843b0a70240598a7 100644 (file)
@@ -218,11 +218,11 @@ dump_gcov_file (const char *filename)
 
   /* stamp */
   unsigned stamp = gcov_read_unsigned ();
-  printf ("%s:stamp %lu\n", filename, (unsigned long)stamp);
+  printf ("%s:stamp %u\n", filename, stamp);
 
   /* Checksum */
   unsigned checksum = gcov_read_unsigned ();
-  printf ("%s:checksum %lu\n", filename, (unsigned long)checksum);
+  printf ("%s:checksum %u\n", filename, checksum);
 
   if (!is_data_type)
     {
index 6623acca2377426cff858e44fc7415b090bdfdaf..b1db727b9581c85903a6784189f701364e4ef6fa 100644 (file)
@@ -1294,8 +1294,9 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
                {
                  error_at_line 
                    (&lexer_line,
-                    "rtx type `%s' has `0' in position %lu, can't handle",
-                    rtx_name[i], (unsigned long) aindex);
+                    "rtx type `%s' has `0' in position "
+                    HOST_SIZE_T_PRINT_UNSIGNED ", can't handle",
+                    rtx_name[i], (fmt_size_t) aindex);
                  t = &string_type;
                  subname = "rt_int";
                }
@@ -1333,9 +1334,10 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
            default:
              error_at_line
                (&lexer_line,
-                "rtx type `%s' has `%c' in position %lu, can't handle",
+                "rtx type `%s' has `%c' in position "
+                HOST_SIZE_T_PRINT_UNSIGNED ", can't handle",
                 rtx_name[i], rtx_format[i][aindex],
-                (unsigned long) aindex);
+                (fmt_size_t) aindex);
              t = &string_type;
              subname = "rt_int";
              break;
index 230a4748efa07ed7f168e36b286f66a076f995ea..55d149e8a40436a7bd07ed6aec2636a65059440f 100644 (file)
@@ -1095,9 +1095,10 @@ write_lookup_constraint_1 (void)
          do
            {
              if (c->namelen > 2)
-               printf ("      if (!strncmp (str + 1, \"%s\", %lu))\n"
+               printf ("      if (!strncmp (str + 1, \"%s\", "
+                                            HOST_SIZE_T_PRINT_UNSIGNED "))\n"
                        "        return CONSTRAINT_%s;\n",
-                       c->name + 1, (unsigned long int) c->namelen - 1,
+                       c->name + 1, (fmt_size_t) (c->namelen - 1),
                        c->c_name);
              else
                printf ("      if (str[1] == '%c')\n"
@@ -1174,8 +1175,8 @@ write_insn_constraint_len (void)
          }
       }
 
-      printf ("    case '%c': return %lu;\n",
-             i, (unsigned long int) c->namelen);
+      printf ("    case '%c': return " HOST_SIZE_T_PRINT_UNSIGNED ";\n",
+             i, (fmt_size_t) c->namelen);
     }
 
   puts ("    default: break;\n"
index fa90dff58550fcfbff503113ba8a89de18125657..4245f843a29f0c96fe095d7064bb8b5aeb0f35e8 100644 (file)
@@ -940,8 +940,9 @@ alloc_page (unsigned order)
 
   if (GGC_DEBUG_LEVEL >= 2)
     fprintf (G.debug_file,
-            "Allocating page at %p, object size=%lu, data %p-%p\n",
-            (void *) entry, (unsigned long) OBJECT_SIZE (order),
+            "Allocating page at %p, object size="
+            HOST_SIZE_T_PRINT_UNSIGNED ", data %p-%p\n",
+            (void *) entry, (fmt_size_t) OBJECT_SIZE (order),
             (void *) page, (void *) (page + entry_size - 1));
 
   return entry;
@@ -1448,8 +1449,10 @@ ggc_internal_alloc (size_t size, void (*f)(void *), size_t s, size_t n
 
   if (GGC_DEBUG_LEVEL >= 3)
     fprintf (G.debug_file,
-            "Allocating object, requested size=%lu, actual=%lu at %p on %p\n",
-            (unsigned long) size, (unsigned long) object_size, result,
+            "Allocating object, requested size="
+            HOST_SIZE_T_PRINT_UNSIGNED ", actual=" HOST_SIZE_T_PRINT_UNSIGNED
+            " at %p on %p\n",
+            (fmt_size_t) size, (fmt_size_t) object_size, result,
             (void *) entry);
 
   return result;
@@ -1621,8 +1624,9 @@ ggc_free (void *p)
 
   if (GGC_DEBUG_LEVEL >= 3)
     fprintf (G.debug_file,
-            "Freeing object, actual size=%lu, at %p on %p\n",
-            (unsigned long) size, p, (void *) pe);
+            "Freeing object, actual size="
+            HOST_SIZE_T_PRINT_UNSIGNED ", at %p on %p\n",
+            (fmt_size_t) size, p, (void *) pe);
 
 #ifdef ENABLE_GC_CHECKING
   /* Poison the data, to indicate the data is garbage.  */
index 29ed1f1e4c1399c0602ede04b4a94b00ce946fa3..f56891325f3df4242f5f371a7c53efb52eefc82a 100644 (file)
@@ -3191,8 +3191,9 @@ sem_item_optimizer::process_cong_reduction (void)
        worklist_push ((*it)->classes[i]);
 
   if (dump_file)
-    fprintf (dump_file, "Worklist has been filled with: %lu\n",
-            (unsigned long) worklist.nodes ());
+    fprintf (dump_file, "Worklist has been filled with: "
+                       HOST_SIZE_T_PRINT_UNSIGNED "\n",
+            (fmt_size_t) worklist.nodes ());
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "Congruence class reduction\n");
@@ -3239,8 +3240,9 @@ sem_item_optimizer::dump_cong_classes (void)
       }
 
   fprintf (dump_file,
-          "Congruence classes: %lu with total: %u items (in a non-singular "
-          "class: %u)\n", (unsigned long) m_classes.elements (),
+          "Congruence classes: " HOST_SIZE_T_PRINT_UNSIGNED " with total: "
+          "%u items (in a non-singular class: %u)\n",
+          (fmt_size_t) m_classes.elements (),
           m_items.length (), m_items.length () - single_element_classes);
   fprintf (dump_file,
           "Class size histogram [number of members]: number of classes\n");
index e277b0132596fd65a30cc39df7a26f634702ab93..6baa838af10a27915c87e912910cb4d9a0199f6d 100644 (file)
@@ -1602,11 +1602,11 @@ new_bitcast (location *loc,
   {
     active_playback_ctxt->add_error (loc,
       "bitcast with types of different sizes");
-    fprintf (stderr, "input expression (size: %ld):\n",
-      (long) tree_to_uhwi (expr_size));
+    fprintf (stderr, "input expression (size: " HOST_WIDE_INT_PRINT_DEC "):\n",
+            tree_to_uhwi (expr_size));
     debug_tree (t_expr);
-    fprintf (stderr, "requested type (size: %ld):\n",
-      (long) tree_to_uhwi (type_size));
+    fprintf (stderr, "requested type (size: " HOST_WIDE_INT_PRINT_DEC "):\n",
+            tree_to_uhwi (type_size));
     debug_tree (t_dst_type);
   }
   tree t_bitcast = build1 (VIEW_CONVERT_EXPR, t_dst_type, t_expr);
index 11e7d63f1becf3f17016dd99f3e80b9edff45767..e54ddf2ca4103ed20d79c246ddfd2d6839e5a00b 100644 (file)
@@ -3021,10 +3021,10 @@ print_lto_report_1 (void)
           total_scc_size + num_unshared_trees_read);
   if (flag_wpa && tree_scc_hash && num_sccs_read)
     {
-      fprintf (stderr, "[%s] tree SCC table: size %ld, %ld elements, "
-              "collision ratio: %f\n", pfx,
-              (long) tree_scc_hash->size (),
-              (long) tree_scc_hash->elements (),
+      fprintf (stderr, "[%s] tree SCC table: size " HOST_SIZE_T_PRINT_DEC ", "
+              HOST_SIZE_T_PRINT_DEC " elements, collision ratio: %f\n", pfx,
+              (fmt_size_t) tree_scc_hash->size (),
+              (fmt_size_t) tree_scc_hash->elements (),
               tree_scc_hash->collisions ());
       hash_table<tree_scc_hasher>::iterator hiter;
       tree_scc *scc, *max_scc = NULL;
@@ -3052,12 +3052,13 @@ print_lto_report_1 (void)
       fprintf (stderr, "[%s] Merged %lu types\n", pfx, num_merged_types);
       fprintf (stderr, "[%s] %lu types prevailed (%lu associated trees)\n",
               pfx, num_prevailing_types, num_type_scc_trees);
-      fprintf (stderr, "[%s] GIMPLE canonical type table: size %ld, "
-              "%ld elements, %ld searches, %ld collisions (ratio: %f)\n", pfx,
-              (long) htab_size (gimple_canonical_types),
-              (long) htab_elements (gimple_canonical_types),
-              (long) gimple_canonical_types->searches,
-              (long) gimple_canonical_types->collisions,
+      fprintf (stderr, "[%s] GIMPLE canonical type table: size "
+              HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC
+              " elements, %d searches, %d collisions (ratio: %f)\n", pfx,
+              (fmt_size_t) htab_size (gimple_canonical_types),
+              (fmt_size_t) htab_elements (gimple_canonical_types),
+              gimple_canonical_types->searches,
+              gimple_canonical_types->collisions,
               htab_collisions (gimple_canonical_types));
       fprintf (stderr, "[%s] GIMPLE canonical type pointer-map: "
               "%lu elements, %ld searches\n", pfx,
index 84e4f89bebacf02694b514bb100e12bee2f9e279..141b5aea32432ef28dacf91b1ce76d029dc652c5 100644 (file)
@@ -487,9 +487,10 @@ static void
 dump_hash_table (FILE *file)
 {
   fprintf (file, "\n\nexpression hash table\n");
-  fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n",
-           (long) expr_table->size (),
-           (long) expr_table->elements (),
+  fprintf (file, "size " HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC
+          " elements, %f collision/search ratio\n",
+           (fmt_size_t) expr_table->size (),
+           (fmt_size_t) expr_table->elements (),
            expr_table->collisions ());
   if (!expr_table->is_empty ())
     {
index 2acd31883a452dd149a922028987f27093902467..cbd3774b21f509ffbfde4785d91d55e3c99d9ee4 100644 (file)
@@ -230,9 +230,10 @@ dump_dfa_stats (FILE *file)
   fprintf (file, "\n");
 
   if (dfa_stats.num_phis)
-    fprintf (file, "Average number of arguments per PHI node: %.1f (max: %ld)\n",
+    fprintf (file, "Average number of arguments per PHI node: %.1f (max: "
+            HOST_SIZE_T_PRINT_DEC ")\n",
             (float) dfa_stats.num_phi_args / (float) dfa_stats.num_phis,
-            (long) dfa_stats.max_num_phi_args);
+            (fmt_size_t) dfa_stats.max_num_phi_args);
 
   fprintf (file, "\n");
 }
index 242b11b29ca9a677762ab31e05ab7b425b4c9110..d12a4a97f651eb83f01d00cc404708a48c999b95 100644 (file)
@@ -1707,9 +1707,10 @@ debug_tree_ssa (void)
 static void
 htab_statistics (FILE *file, const hash_table<var_info_hasher> &htab)
 {
-  fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n",
-          (long) htab.size (),
-          (long) htab.elements (),
+  fprintf (file, "size " HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC
+          " elements, %f collision/search ratio\n",
+          (fmt_size_t) htab.size (),
+          (fmt_size_t) htab.elements (),
           htab.collisions ());
 }
 
index d8f43585a40ae637ca9afba293dde967a195b203..73264852ebd94651fd8b10ab5256c929710618d1 100644 (file)
@@ -1482,9 +1482,10 @@ record_equivalences_from_incoming_edge (basic_block bb,
 static void
 htab_statistics (FILE *file, const hash_table<expr_elt_hasher> &htab)
 {
-  fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n",
-          (long) htab.size (),
-          (long) htab.elements (),
+  fprintf (file, "size " HOST_SIZE_T_PRINT_DEC ", " HOST_SIZE_T_PRINT_DEC
+          " elements, %f collision/search ratio\n",
+          (fmt_size_t) htab.size (),
+          (fmt_size_t) htab.elements (),
           htab.collisions ());
 }
 
index 3dff8c510832d154d1ac5de3871384ab21141a94..046a558d1b07bf414fbf4f27c1953c0b7f8f8a66 100644 (file)
@@ -5882,9 +5882,10 @@ decl_fini_priority_insert (tree decl, priority_type priority)
 static void
 print_debug_expr_statistics (void)
 {
-  fprintf (stderr, "DECL_DEBUG_EXPR  hash: size %ld, %ld elements, %f collisions\n",
-          (long) debug_expr_for_decl->size (),
-          (long) debug_expr_for_decl->elements (),
+  fprintf (stderr, "DECL_DEBUG_EXPR  hash: size " HOST_SIZE_T_PRINT_DEC ", "
+          HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n",
+          (fmt_size_t) debug_expr_for_decl->size (),
+          (fmt_size_t) debug_expr_for_decl->elements (),
           debug_expr_for_decl->collisions ());
 }
 
@@ -5893,9 +5894,10 @@ print_debug_expr_statistics (void)
 static void
 print_value_expr_statistics (void)
 {
-  fprintf (stderr, "DECL_VALUE_EXPR  hash: size %ld, %ld elements, %f collisions\n",
-          (long) value_expr_for_decl->size (),
-          (long) value_expr_for_decl->elements (),
+  fprintf (stderr, "DECL_VALUE_EXPR  hash: size " HOST_SIZE_T_PRINT_DEC ", "
+          HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n",
+          (fmt_size_t) value_expr_for_decl->size (),
+          (fmt_size_t) value_expr_for_decl->elements (),
           value_expr_for_decl->collisions ());
 }
 
@@ -6287,9 +6289,10 @@ type_hash_canon (unsigned int hashcode, tree type)
 static void
 print_type_hash_statistics (void)
 {
-  fprintf (stderr, "Type hash: size %ld, %ld elements, %f collisions\n",
-          (long) type_hash_table->size (),
-          (long) type_hash_table->elements (),
+  fprintf (stderr, "Type hash: size " HOST_SIZE_T_PRINT_DEC ", "
+          HOST_SIZE_T_PRINT_DEC " elements, %f collisions\n",
+          (fmt_size_t) type_hash_table->size (),
+          (fmt_size_t) type_hash_table->elements (),
           type_hash_table->collisions ());
 }
 
index fd3aafb6418374a9ae85b2e5f04b52bfdbf53a32..08174669c2692d572f528dbb7cf763a7b3f2548e 100644 (file)
@@ -7335,8 +7335,8 @@ dump_var (variable *var)
 
   for (i = 0; i < var->n_var_parts; i++)
     {
-      fprintf (dump_file, "    offset %ld\n",
-              (long)(var->onepart ? 0 : VAR_PART_OFFSET (var, i)));
+      fprintf (dump_file, "    offset " HOST_WIDE_INT_PRINT_DEC "\n",
+              var->onepart ? 0 : VAR_PART_OFFSET (var, i));
       for (node = var->var_part[i].loc_chain; node; node = node->next)
        {
          fprintf (dump_file, "      ");
index fa17eff551e87e8dbc97687601ddef22c3e1a5d3..008d9b133032643991153ac477d71d99290dd42b 100644 (file)
@@ -4365,7 +4365,7 @@ output_constant_pool_contents (struct rtx_constant_pool *pool)
        p = label;
        if (desc->offset)
          {
-           sprintf (buffer, "%s+%ld", p, (long) (desc->offset));
+           sprintf (buffer, "%s+" HOST_WIDE_INT_PRINT_DEC, p, desc->offset);
            p = buffer;
          }
        ASM_OUTPUT_DEF (asm_out_file, name, p);