This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Are egcs optimizations safe for conservative GC?
- To: law at cygnus dot com
- Subject: Re: Are egcs optimizations safe for conservative GC?
- From: Kevin Atkinson <kevinatk at home dot com>
- Date: Tue, 04 Jan 2000 22:49:33 -0500
- CC: Rickard Westman <riw at swipnet dot se>, egcs at egcs dot cygnus dot com
- References: <1425.926884468@upchuck.cygnus.com>
Jeffrey A Law wrote:
>
> In message <373F1F2B.D0AC8171@swipnet.se>you write:
> > doubly-linked lists) but that is usually not much of a concern. A more
> > severe problem would be if the compiler obscured the only pointer to a
> > live memory block "behind the programmer's back" as part of a clever
> > optimization or code generation technique. The block would then risk
> > being freed in error, leading to nasty memory corruption problems which
> > could be very difficult to track down and fix.
>
> This kind of thing can and does happen. The loop optimizer can create such
> addresses as can code to optimize address arithmetic.
>
> > Boehm says that such problems are extremely rare with current compilers,
> > and that such problems have only been detected in contrived examples
> > especially constructed for the purpose. But he also suggests that it
> > might become more of a problem with future sophisticated optimization
> > techniques(1).
> As a compiler junkie, I would say the opposite. It does not take a contrived
> example. One just has to know how optimizers work to build such examples :-)
>
> I wrote a fairly extensive writeup of these issues back in 1992 or 1993 when
> we were considering Boehm GC for a project I was working on at the UofU, but
> I doubt I'd be able to find it in my 1992/1993 outbox :(
The last time this came up I got two very diffrent answers and no one
answered my question of how to prevent the loop optimizer from doing
this. Is gcc GC safe is there is always at least one variable that is
not a local pointing to the object in question? Is there anything one
can do with volatile to help prevent this?
--
Kevin Atkinson
kevinatk@home.com
http://metalab.unc.edu/kevina/