On Thu, Feb 01, 2024 at 02:53:47PM +0000, Jonathan Yong wrote:
> On 2/1/24 14:33, Xi Ruoyao wrote:
> > 
> > I mean if you are casting it to unsigned HOST_WIDE_INT, you should use
> > HOST_WIDE_INT_PRINT_UNSIGNED,  If you are casting it to size_t you
> > cannot use it (as Jakub has explained).
> > 
> > When you use printf-like things you have to keep the correspondence
> > between format specifier and the argument itself,
> > 
> > > No, that is wrong.  That will break bootstrap on lots of hosts, any time
> > > size_t is not unsigned long (if unsigned long is 64-bit) or unsigned long
> > > long (if unsigned long is not 64-bit).
> > > That includes e.g. all targets where size_t is unsigned int, and some 
> > > others
> > > too.
> > > 
> > >   Jakub
> > > 
> > 
> 
> Thanks, that makes sense, tested on x86_64-linux.

No, besides the formatting being incorrect both in ChangeLog and in the
patch, this pessimizes ILP32 hosts unnecessarily.

> diff --git a/gcc/ira-conflicts.cc b/gcc/ira-conflicts.cc
> index 671b4e42b6f..ff5db18ffcc 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 "HOST_WIDE_INT_PRINT_UNSIGNED" bytes for conflict 
> table (uncompressed size "HOST_WIDE_INT_PRINT_UNSIGNED")\n",
> +       (unsigned HOST_WIDE_INT)(allocated_words_num * sizeof (IRA_INT_TYPE)),
> +       (unsigned HOST_WIDE_INT)(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++)

        Jakub

Reply via email to