[Info-vax] Ada x86 (was Rdb/x86)

Simon Clubley clubley at remove_me.eisner.decus.org-Earth.UFP
Tue Dec 1 08:07:30 EST 2020


On 2020-11-30, John Dallman <jgd at cix.co.uk> wrote:
>
> Bringing back the GCC toolchain might be a good idea anyway. I've
> remembered an LLVM feature that caused me trouble a few years back, which
> may surprise people used to the DEC compilers. 
>
> With GCC, and AFAIK with the DEC compilers, one can enable floating-point
> traps, and get sensible results, trapping when you divide by zero,
> overflow or try an invalid operation, such as sqrt(-1.0). 
>
> GCC is well aware that floating-point operations may cause traps, and its
> optimiser limits the rearrangement of code so that you don't get spurious
> ones. For example if you have:
>
>         double a, b; 
>         ...
>         if ( b < really-small-number)
>                 a = 0.0;
>         else
>                 a = 1.0 / b;
>
> GCC won't move the divide out from under the test that guards against
> divide-by-zero. 
>

Would declaring the variables volatile have avoided this reordering ?

And talking of volatile, I wonder if John has encountered any cases
with LLVM where variables now need to be declared volatile where they
did not need to be with the DEC compilers.

Simon.

-- 
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.



More information about the Info-vax mailing list