Need advice on bounds checking approaches

Geoff Keating geoffk@cygnus.com
Tue Mar 28 12:30:00 GMT 2000


> Cc: law@cygnus.com, gcc@gcc.gnu.org
> From: Greg McGary <gkm@eng.ascend.com>
> Date: 28 Mar 2000 13:25:51 -0700
> 
> Geoff Keating <geoffk@cygnus.com> writes:
> 
> > They shouldn't end a basic block.  So long as the compiler knows that
> > 'trap' RTXs are memory barriers, I think it can optimise them just
> > like any other insn; and I think that's what it now does.
> 
> Please expand on this.  I'm not sure what you mean here.  My only
> knowledge of barriers is what's in the gcc manual, namely that they
> mark places where control cannot flow past.  However, this is not the
> case with bounds checks.  Most often, control flows past the checks
> because the trap condition is false.  Even when the trap condition is
> true, the OS should have the option of logging the failure then
> resuming execution rather than simply terminating.

By 'memory barrier', I mean an instruction over which it is not safe
to move memory accesses.  It would be annoying if in the code sequence

   if (i > 10) trap;
   a[i] = 3;

the store to the array was moved before the trap.

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Gcc mailing list