[Gc] returning stack address without a warning

Andrew Haley aph at redhat.com
Thu Oct 26 03:33:20 PDT 2006

Eric Deplagne writes:
 > > My goal with -Wall and similar is to at least document any remaining
 > > warnings in the source.  The collector inherently does a few things that
 > > should generate warnings in "normal" code, e.g. it returns the address
 > > of a local to get an upper bound on the stack pointer.  This also really
 > > applies only to gc7.
 > If there's nothing clever I didn't notice on the way, using an helper
 > function is enough to prevent the compiler from noticing what we're doing
 > to that poor local variable...

No, that's a bad idea.  Later versions of the compiler may well see
through this trick and you'll get the warning again.  It is better
either to use a properly supported way to the the stack address or to
live with the warning than to go through such contortions.


More information about the Gc mailing list