On Thu, Jun 27, 2019 at 04:03:06PM +0200, Martin Liška wrote:
>       * ggc-page.c (free_page): Use (char *) for %p printf format
>       argument.

> --- a/gcc/ggc-page.c
> +++ b/gcc/ggc-page.c
> @@ -977,7 +977,7 @@ free_page (page_entry *entry)
>    if (GGC_DEBUG_LEVEL >= 2)
>      fprintf (G.debug_file,
>            "Deallocating page at %p, data %p-%p\n", (void *) entry,
> -          entry->page, entry->page + entry->bytes - 1);
> +          (char *)entry->page, (char *)entry->page + entry->bytes - 1);
>  
>    /* Mark the page as inaccessible.  Discard the handle to avoid handle
>       leak.  */

Can you explain this?  It makes no sense to me.  What is the warning?
entry->page already has char * type, so why are any casts needed?
If you want to be pedantic, C says that %p argument should be pointer to
void, so I'd understand more
             (void *) entry->page, (void *) (entry->page + entry->bytes - 1));
with that formatting.

        Jakub

Reply via email to