[Gc] Gc segfault with gcc-3.4 and Gc segfault under valgrind

Andrew Haley aph at redhat.com
Thu Nov 16 07:04:50 PST 2006


Eric Deplagne writes:
 > On Thu, 16 Nov 2006 13:29:51 +0000, Andrew Haley wrote:
 > > 
 > > Yes, you did get the meaning of volatile wrong.  volatile stops it
 > > from being moved or from being executed more than once.  Your're
 > > telling gcc that this asm depends on something that gcc doesn't know
 > > about.  For example, if you have an asm that reads a counter, you have
 > > to make that asm volatile or gcc will assume that its result does not
 > > change.
 > 
 >   Like it could just move it outside of the loop.
 > 
 >   Means "asm volatile" is the thing to do in my case,

Yes.

 >   if I wanted to keep the asm()...

 >   Still funny only gcc-3.4 did reorder the thing...

It's true that optimizers do odd things when presented with incorrect
code, and do different odd things in different versions.  However, it
is rarely productive or interesting to try to figure out why.

If you lie to gcc, or even if you fail to tell gcc the whole truth, it
will bite you.

Andrew.


More information about the Gc mailing list