[RFA] Avoid aliasing problems tickled by gcc-3.4.4

Christopher Faylor me@cgf.cx
Thu Jun 16 19:26:00 GMT 2005

On Thu, Jun 16, 2005 at 03:21:27PM -0400, Jeff Johnston wrote:
>Christopher Faylor wrote:
>Sorry about the delay.  Patch checked in.

Thanks, Jeff.

>>On Sat, Jun 11, 2005 at 03:23:01PM -0400, Christopher Faylor wrote:
>>>[Reply-To set]
>>>We've recently upgraded gcc to 3.4.4 on Cygwin and found what appear to
>>>be a few aliasing problems in newlib source.  The patch below fixes this
>>>with the use of unions to reference long double values rather than by
>>>coercing a long double pointer to some other type of pointer.
>>>The change to vfprintf.c fixed one observed problem in cygwin.  I made
>>>the change to ldtoa.c because -Wstrict-aliasing uncovered problems in
>>>that file.
>>>There might be another, more elegant way to do this.  If so, I'd be happy
>>>to entertain suggestions.  If not, I think these changes make sense.
>The changes are fine.  They are according to the gcc postings on strict 
>aliasing and type-punning.

Really?  I wasn't really sure about the ldtoa.c changes since I didn't detect
any obvious breakage there.

>>>Meta-topic: Should "-Wstrict-aliasing" be turned on by default for newlib 
>It might be prudent to make it work cleanly for gcc4 before doing this.

Ok.  Corinna has worked at getting cygwin building cleanly with gcc4.  I
think one or both of us will probably get to doing that eventually.


More information about the Newlib mailing list