Gentoo Logo
Gentoo Spaceship

Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-amd64
Lists: gentoo-amd64: < Prev By Thread Next > < Prev By Date Next >
To: "gentoo-amd64@g.o" <gentoo-amd64@g.o>
From: Ian McCulloch <ianmcc@...>
Subject: Re: Re: GCC-4.5.2 Has Serious Problems
Date: Fri, 01 Jul 2011 04:30:20 +0200 (CEST)
On Fri, 1 Jul 2011, Frank Peters wrote:                                                                                                                                      
> On Fri, 1 Jul 2011 00:58:46 +0000 (UTC)  Duncan <1i5t5.duncan@...> 
> wrote:
> >                                                                                                                                                                          
> > I had wondered if this might be an "undefined behavior" optimization 
> > bug,
> >                                                                                                                                                                          
> Well, the amd64 users list may not be the appropriate place to discuss C 
> programming, but the problem here stems from attempting to do things 
> with C that are not supposed to be done with C.  Such things are aptly 
> called "tricks" because they stray away from the convention.
I don't think that is true - C has ALWAYS had rules on strict aliasing, 
even from the first attempts at standardization.
Unfortunately it is only recently that common compilers and hardware have 
really taken advantage of the way the language works to give better 
optimizing performance by storing more variables in registers rather than 
reloading pointers from memory every time.  Mostly this is due to the 
small number of registers in the x86 architecture, doesn't lend itself to 
these optimisations as well as other architectures.  Contrast with Itanium 
for example with lots of registers, some of which are designed to be 
preserved across a function call.  FORTRAN compilers have taken advantage 
of aliasing optimizations right from the beginning (ie, since the 
1960's!), and commodity C compilers are only now just catching up!  So 
these are hardly new optimizations.
> Ideally, I suppose, for these purposes would be to use assembly language 
> routines mixed into the C code.  But this is not as easy as with the 
> "tricks."
Not at all, it is about producing more efficient assembly, using the 
language rules that have existed practically forever.  If programmers have 
become accustomed to violating those rules, then they'll just have to get 
accustomed to not violating them.  The rules aren't hard!  And if you DO 
want to alias pointers of different types, then there are well-defined 
ways of doing that, and the resulting code tends to be much more readable 


Lists: gentoo-amd64: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
GCC-4.5.2 Has Serious Problems
Next by thread:
Glibc Update Breaks Open/LibreOffice -- Can't Downgrade
Previous by date:
Re: Re: GCC-4.5.2 Has Serious Problems
Next by date:
Re: Re: GCC-4.5.2 Has Serious Problems

Updated Jun 28, 2012

Summary: Archive of the gentoo-amd64 mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.