https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106416

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> > The second warning looks wrong to me.
> 
> It is right. Try doing the cast to int instead of a pointer (to int).

Thanks for the correction. gcc does the right thing.

New warning output is:

$ /home/dcb/gcc/results/bin/gcc -c -std=c2x bug834.c
bug834.c: In function ‘f’:
bug834.c:6:17: warning: initialization of ‘int’ from ‘int *’ makes integer from
pointer without a cast [-Wint-conversion]
    6 |         int a = p;
      |                 ^
bug834.c:7:17: warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]
    7 |         int b = (int) p;
      |                 ^
$

Reply via email to