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]

Re: C++ Garbage Collecter


  In message <37C360C0.46D76D79@mindspring.com>you write:
  > That project used the MIPS native compiler (not gcc) which has
  > a fairly agressive optimizer.  We never had a problem with the
  > GC and optimzer not getting along.
But that does not mean you will not run into such problems.  As a compiler
junkie, I *know* GCC will create situations which will spoof a garbage
collector.

  > There are a couple of coding techniques that can cause trouble.
  > 1. Only storing (only) a pointer to an object that is outside the object,
  > 
  > for example
  >     char * alloc() {
  >         char * x = (char *) malloc( 100 );
  >         return x-10;
  >     }
  > then the calling code knows to add 10 before using it.  This is highly
  > perverse code and not likely to be found in practice, but it would break
  > the Boehm GC.
Actually, compilers do this internally sometimes as it allows them to generate
more efficient loop code.

jeff


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