public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Warning in makedoc.c
@ 2014-10-28 22:25 Joel Sherrill
  2014-10-29 10:49 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Sherrill @ 2014-10-28 22:25 UTC (permalink / raw)
  To: newlib

Hi

On a 64-bit Fedora 20 machine, I see this building newlib:

../../../../gcc/newlib/doc/makedoc.c: In function ‘push_number’:
../../../../gcc/newlib/doc/makedoc.c:273:12: warning: cast from pointer
to integer of different size [-Wpointer-to-int-cast]
*isp = (int)(*pc);
^
../../../../gcc/newlib/doc/makedoc.c: In function ‘bang’:
../../../../gcc/newlib/doc/makedoc.c:1341:2: warning: cast to pointer
from integer of different size [-Wint-to-pointer-cast]
*(int *)((isp[0])) = isp[-1];
^
../../../../gcc/newlib/doc/makedoc.c: In function ‘atsign’:
../../../../gcc/newlib/doc/makedoc.c:1349:15: warning: cast to pointer
from integer of different size [-Wint-to-pointer-cast]
isp[0] = *(int *)(isp[0]);

Can makedoc.c use int32_t?

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

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

* Re: Warning in makedoc.c
  2014-10-28 22:25 Warning in makedoc.c Joel Sherrill
@ 2014-10-29 10:49 ` Corinna Vinschen
  2014-10-29 16:43   ` Joel Sherrill
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2014-10-29 10:49 UTC (permalink / raw)
  To: newlib

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

On Oct 28 17:25, Joel Sherrill wrote:
> Hi
> 
> On a 64-bit Fedora 20 machine, I see this building newlib:
> 
> ../../../../gcc/newlib/doc/makedoc.c: In function ‘push_number’:
> ../../../../gcc/newlib/doc/makedoc.c:273:12: warning: cast from pointer
> to integer of different size [-Wpointer-to-int-cast]
> *isp = (int)(*pc);
> ^
> ../../../../gcc/newlib/doc/makedoc.c: In function ‘bang’:
> ../../../../gcc/newlib/doc/makedoc.c:1341:2: warning: cast to pointer
> from integer of different size [-Wint-to-pointer-cast]
> *(int *)((isp[0])) = isp[-1];
> ^
> ../../../../gcc/newlib/doc/makedoc.c: In function ‘atsign’:
> ../../../../gcc/newlib/doc/makedoc.c:1349:15: warning: cast to pointer
> from integer of different size [-Wint-to-pointer-cast]
> isp[0] = *(int *)(isp[0]);
> 
> Can makedoc.c use int32_t?

How does that help on 64 bit systems?  I don't claim to understand
what makedoc is doing there, but shouldn't pointers be casted to
intptr_t or uintptr_t ideally?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: Warning in makedoc.c
  2014-10-29 10:49 ` Corinna Vinschen
@ 2014-10-29 16:43   ` Joel Sherrill
  2014-10-29 19:52     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Sherrill @ 2014-10-29 16:43 UTC (permalink / raw)
  To: newlib


On 10/29/2014 5:48 AM, Corinna Vinschen wrote:
> On Oct 28 17:25, Joel Sherrill wrote:
>> Hi
>>
>> On a 64-bit Fedora 20 machine, I see this building newlib:
>>
>> ../../../../gcc/newlib/doc/makedoc.c: In function ‘push_number’:
>> ../../../../gcc/newlib/doc/makedoc.c:273:12: warning: cast from pointer
>> to integer of different size [-Wpointer-to-int-cast]
>> *isp = (int)(*pc);
>> ^
>> ../../../../gcc/newlib/doc/makedoc.c: In function ‘bang’:
>> ../../../../gcc/newlib/doc/makedoc.c:1341:2: warning: cast to pointer
>> from integer of different size [-Wint-to-pointer-cast]
>> *(int *)((isp[0])) = isp[-1];
>> ^
>> ../../../../gcc/newlib/doc/makedoc.c: In function ‘atsign’:
>> ../../../../gcc/newlib/doc/makedoc.c:1349:15: warning: cast to pointer
>> from integer of different size [-Wint-to-pointer-cast]
>> isp[0] = *(int *)(isp[0]);
>>
>> Can makedoc.c use int32_t?
> How does that help on 64 bit systems?  I don't claim to understand
> what makedoc is doing there, but shouldn't pointers be casted to
> intptr_t or uintptr_t ideally?
>
I have no idea about makedoc either. :)

Looking a bit at the code, I assume that chaning it to a Xintptr_t
would have to propagate back to the declarations of istack and isp
around line 220. And that may result in changing more variables
from int to Xintptr_t. I can take a swing at it it you think that is an
OK way to fix the warning.

FWIW Looks like very old and crusty code. I see odd spacing,
and an if 0 section.
> Corinna
>

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

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

* Re: Warning in makedoc.c
  2014-10-29 16:43   ` Joel Sherrill
@ 2014-10-29 19:52     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2014-10-29 19:52 UTC (permalink / raw)
  To: newlib

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

On Oct 29 11:43, Joel Sherrill wrote:
> 
> On 10/29/2014 5:48 AM, Corinna Vinschen wrote:
> > On Oct 28 17:25, Joel Sherrill wrote:
> >> Hi
> >>
> >> On a 64-bit Fedora 20 machine, I see this building newlib:
> >>
> >> ../../../../gcc/newlib/doc/makedoc.c: In function ‘push_number’:
> >> ../../../../gcc/newlib/doc/makedoc.c:273:12: warning: cast from pointer
> >> to integer of different size [-Wpointer-to-int-cast]
> >> *isp = (int)(*pc);
> >> ^
> >> ../../../../gcc/newlib/doc/makedoc.c: In function ‘bang’:
> >> ../../../../gcc/newlib/doc/makedoc.c:1341:2: warning: cast to pointer
> >> from integer of different size [-Wint-to-pointer-cast]
> >> *(int *)((isp[0])) = isp[-1];
> >> ^
> >> ../../../../gcc/newlib/doc/makedoc.c: In function ‘atsign’:
> >> ../../../../gcc/newlib/doc/makedoc.c:1349:15: warning: cast to pointer
> >> from integer of different size [-Wint-to-pointer-cast]
> >> isp[0] = *(int *)(isp[0]);
> >>
> >> Can makedoc.c use int32_t?
> > How does that help on 64 bit systems?  I don't claim to understand
> > what makedoc is doing there, but shouldn't pointers be casted to
> > intptr_t or uintptr_t ideally?
> >
> I have no idea about makedoc either. :)
> 
> Looking a bit at the code, I assume that chaning it to a Xintptr_t
> would have to propagate back to the declarations of istack and isp
> around line 220. And that may result in changing more variables
> from int to Xintptr_t. I can take a swing at it it you think that is an
> OK way to fix the warning.

Sure.  Please go ahead.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-10-29 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-28 22:25 Warning in makedoc.c Joel Sherrill
2014-10-29 10:49 ` Corinna Vinschen
2014-10-29 16:43   ` Joel Sherrill
2014-10-29 19:52     ` Corinna Vinschen

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).