This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: malloc attributes and realloc


 > From: Geoff Keating <geoffk@geoffk.org>
 > 
 > "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 > 
 > >  > From: Geoff Keating <geoffk@geoffk.org>
 > >  > 
 > >  > "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 > >  > 
 > >  > > The pointer comparison code in alloca.c is the way we support the
 > >  > > alloca() function for NON-gcc compilers.  Therefore pointer comparison
 > >  > > works on _every_ stage1 compiler used to bootstrap gcc going back to
 > >  > > the oldest traditional C compiler up until today's ISO C.  That's a
 > >  > > lot of compilers supporting this so-called extension which is why
 > >  > > (other than for segmented arches) I find it surprising we cannot rely
 > >  > > on this behavior. ;-)
 > >  > 
 > >  > Note that stage1 is done without optimisation.  I seem to remember
 > >  > that at -O0, GCC doesn't do aliasing analysis at all.
 > > 
 > > Eh?  What does that have to do with pointer ">" comparison?
 > 
 > You were saying that "pointer comparison works on _every_ stage1
 > compiler", and I was pointing out that this isn't very surprising,
 > since stage1 is built without optimisation, and at least one compiler
 > disables aliasing analysis when optimisation is switched off.
 > 
 > > Besides alloca.c has been used in many other GNU packages besides GCC
 > > over the years.
 > 
 > Doesn't autoconf also disable optimisation by default when not using GCC?

Yes, you're right about autoconf.

However, what I don't understand is that you seem to indicate that it
is alias analysis (at some optimization level) that invalidates
pointer comparison.  I thought it was an underlying (e.g. non-flat)
memory model, in which case optimization shouldn't matter.  Would you
please explain how alias analysis enters into this sub-thread?

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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