This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Avoid aliasing problems tickled by gcc-3.4.4


Christopher Faylor wrote:
On Thu, Jun 16, 2005 at 03:21:27PM -0400, Jeff Johnston wrote:

Christopher Faylor wrote:

ping?

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.


Sorry, I am confused here. I thought you said that using the -Wstrict-aliasing option uncovered problems in ldtoa.c. The recommended way from gcc to handle such aliasing problems is to use a union.



Meta-topic: Should "-Wstrict-aliasing" be turned on by default for newlib builds?

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.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]