This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, ira] Make ira printf type correct


Michael Meissner wrote:
On Tue, Jun 10, 2008 at 01:32:16PM -0400, Jakub Jelinek wrote:
On Tue, Jun 10, 2008 at 01:19:52PM -0400, Michael Meissner wrote:
I tried to bootstrap the ira compiler on a 32-bit Red Hat system, and it did
not bootstrap due to a type conflict between a fprintf that used %ld to print
out types that are int. This patch fixes the immediate problem, but perhaps it
is better to cast the types to long before doing the multiplies in case of
overflow.
This will break 64-bit builds.  As we can't use %zd, because we still
support pre-ISO C99 hosts, I'm afraid casting both arguments to (long)
is the way to go.

2008-06-10 Michael Meissner <michael.meissner@amd.com>

	* ira-conflicts.c (build_conflict_bit_table): Make tracing fprintf
	type correct.

Index: gcc/ira-conflicts.c
===================================================================
--- gcc/ira-conflicts.c (revision 136625)
+++ gcc/ira-conflicts.c (working copy)
@@ -112,7 +112,7 @@ 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",
+ "+++Allocating %u bytes for conflict table (uncompressed size %u)\n",
allocated_words_num * sizeof (INT_TYPE),
allocno_set_words * allocnos_num * sizeof (INT_TYPE));
for (i = 0; i < max_point; i++)
Jakub


Right. I think I was thinking of a ILP64 system, and not LP64 where int is 64-bit also. Here is a corrected patch:

Mike, thanks for reporting the problem. I've submitted a bit different patch.

http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00607.html
2008-06-10 Michael Meissner <michael.meissner@amd.com>

	* ira-conflicts.c (build_conflict_bit_table): Make tracing fprintf
	type correct.

Index: gcc/ira-conflicts.c
===================================================================
--- gcc/ira-conflicts.c	(revision 136625)
+++ gcc/ira-conflicts.c	(working copy)
@@ -112,9 +112,10 @@ 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",
-       allocated_words_num * sizeof (INT_TYPE),
-       allocno_set_words * allocnos_num * sizeof (INT_TYPE));
+       "+++Allocating %lu bytes for conflict table (uncompressed size %lu)\n",
+       (unsigned long)allocated_words_num * sizeof (INT_TYPE),
+       ((unsigned long)allocno_set_words * (unsigned long)allocnos_num
+	* sizeof (INT_TYPE)));
   for (i = 0; i < max_point; i++)
     {
       for (r = start_point_ranges[i]; r != NULL; r = r->start_next)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]