Need advice on bounds checking approaches

Geoff Keating geoffk@cygnus.com
Wed Mar 29 13:35:00 GMT 2000


Jeffrey A Law <law@cygnus.com> writes:

>   In message < msaejkt998.fsf@gkm-dsl-194.ascend.com >you write:
>   > > 
>   > > I'd be much happier if we could find a clean way to get the optimizations
>   > > you need using our existing optimizers.
>   > 
>   > We can do without a special pass.  CSE seems the best place to
>   > eliminate redundant checks, so we'd just need a little bit of code to
>   > handle the new check_bounds_rtx.  We can just forget about doing
>   > default translation of check_bounds_rtx into primitive RTL, and
>   > require that targets supporting bounds checking handle it in the
>   > machine description.  So far, all of the targets I want to support
>   > initially (i960, PowerPC, i386, MIPS) will benefit from special
>   > handling in the MD file anyway.
>   > 
>   > Does that sound reasonable?
> Seems reasonable.  We should probably have some way to automatically warn the
> user if they try to use bounded pointers on a target which does not have 
> conditional traps, etc.

like this code:

    case BUILT_IN_TRAP:
#ifdef HAVE_trap
      if (HAVE_trap)
	emit_insn (gen_trap ());
      else
#endif
	error ("__builtin_trap not supported by this target");
      emit_barrier ();
      return const0_rtx;

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


More information about the Gcc mailing list