public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Change gcc/ira-conflicts.cc build_conflict_bit_table to use size_t/%zu
@ 2024-02-01 12:45 Jonathan Yong
  2024-02-01 13:01 ` Jakub Jelinek
  0 siblings, 1 reply; 15+ messages in thread
From: Jonathan Yong @ 2024-02-01 12:45 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

Attached patch OK? Copied inline for review convenience.

diff --git a/gcc/ira-conflicts.cc b/gcc/ira-conflicts.cc
index 671b4e42b6f..e966afe6cdc 100644
--- a/gcc/ira-conflicts.cc
+++ b/gcc/ira-conflicts.cc
@@ -150,9 +150,9 @@ build_conflict_bit_table (void)
    if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
      fprintf
        (ira_dump_file,
-       "+++Allocating %ld bytes for conflict table (uncompressed size %ld)\n",
-       (long) allocated_words_num * sizeof (IRA_INT_TYPE),
-       (long) object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE));
+       "+++Allocating %zu bytes for conflict table (uncompressed size %zu)\n",
+       (size_t)(allocated_words_num * sizeof (IRA_INT_TYPE)),
+       (size_t)(object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE)));
  
    objects_live = sparseset_alloc (ira_objects_num);
    for (i = 0; i < ira_max_point; i++)

[-- Attachment #2: 0001-PR-target-43613-use-zu-for-build_conflict_bit_table.patch --]
[-- Type: text/x-patch, Size: 1321 bytes --]

From 48861b8578526ac199b123ff71af8f9778c396c3 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Thu, 1 Feb 2024 12:35:52 +0000
Subject: [PATCH] PR target/43613: use %zu for build_conflict_bit_table

LLP64 platforms like uses 32bit for long and may truncate. Use
size_t and %zu to guarantee 64bit lengths.

gcc:
	*ira-conflicts.cc: use %zu for build_conflict_bit_table.
---
 gcc/ira-conflicts.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/ira-conflicts.cc b/gcc/ira-conflicts.cc
index 671b4e42b6f..e966afe6cdc 100644
--- a/gcc/ira-conflicts.cc
+++ b/gcc/ira-conflicts.cc
@@ -150,9 +150,9 @@ build_conflict_bit_table (void)
   if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
     fprintf
       (ira_dump_file,
-       "+++Allocating %ld bytes for conflict table (uncompressed size %ld)\n",
-       (long) allocated_words_num * sizeof (IRA_INT_TYPE),
-       (long) object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE));
+       "+++Allocating %zu bytes for conflict table (uncompressed size %zu)\n",
+       (size_t)(allocated_words_num * sizeof (IRA_INT_TYPE)),
+       (size_t)(object_set_words * ira_objects_num * sizeof (IRA_INT_TYPE)));
 
   objects_live = sparseset_alloc (ira_objects_num);
   for (i = 0; i < ira_max_point; i++)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-09 10:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 12:45 [PATCH] Change gcc/ira-conflicts.cc build_conflict_bit_table to use size_t/%zu Jonathan Yong
2024-02-01 13:01 ` Jakub Jelinek
2024-02-01 13:06   ` Xi Ruoyao
2024-02-01 13:42     ` Jonathan Yong
2024-02-01 13:55       ` Jakub Jelinek
2024-02-01 14:33         ` Xi Ruoyao
2024-02-01 14:53           ` Jonathan Yong
2024-02-01 14:55             ` Jakub Jelinek
2024-02-01 15:25               ` Jakub Jelinek
2024-02-01 15:33                 ` Jonathan Yong
2024-02-02 23:43                   ` Jonathan Yong
2024-02-03  0:03                     ` Jakub Jelinek
2024-02-09 10:33                 ` Richard Biener
2024-02-01 13:13   ` Jakub Jelinek
2024-02-01 14:53     ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).