> > -ftrapv is not practically usable because (1) it generates awful code and
> > (2) it badly interacts with the RTL optimizers.
>
> please before you say this compare it with the truly awful front end
> code we generate, which for sure inteferes badly with the optimizers.

Right, the code generated by the front end is not pretty either, but at least 
the front-end knows what it is doing Ada-wise.  -ftrapv is so dumb at the 
moment that it emits checks for virtually anything.

As for the interaction with the optimizers:

int foo(int a, int b)
{
  return a + b;
}

gcc -S -O -ftrapv on SPARC:
foo:
        jmp     %o7+8
         add    %o0, %o1, %o0
        .size   foo, .-foo
        .ident  "GCC: (GNU) 4.1.0 20050604 (experimental)"

And I have a slightly more contrived example with the same problem at -O0!


I think we cannot use -ftrapv alone for Ada because it is too low-level.  Its 
general mechanism certainly can help (once it is fixed) but it must be driven 
by something more Ada-aware.

-- 
Eric Botcazou

Reply via email to