Andrew Haley wrote:
>From a performance/convenience angle, the best place to handle this is
either libc or the kernel.  Either of these can quite easily fix up
the operands when a trap happens, with zero performance degradation of
existing code.  I don't think there's any need for gcc to be altered
to handle this.
Unfortunately this is only partially correct. As Vincent Lefe`vre <mailto:[EMAIL PROTECTED]> has noted
in PR30484/, /PPC generates no trap but gives incorrect result:

   "-2147483648 % -1 -> -2147483648"

A signal handler will not help here.

Another problem is -ftrapv. You wouldn't want to kill traps on

   INT_MIN/-1

with -ftrapv, would you?

GCC should be modified such that libc/kernel can distinguish
INT_MIN/-1 from INT_MIN%-1.

--
Michael Veksler
http:///tx.technion.ac.il/~mveksler

Reply via email to