This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
New option?
- From: "Sam Lauber" <sam124 at operamail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 29 Jan 2005 03:02:45 +0100
- Subject: New option?
I think an option -ftrapping-integer-math should be added
to GCC that generates calls to the libgcc functions
__XXXvdiX and ___XXXvsiX that call `abort()' for overflow
instead of calls to the regular assembly instructions for
that task. I.e. on x86, to add ebx + ebx into eax, instead
of
addl %ebx, %ebx
movl %ebx, %eax
it would do
pushl %ebx
pushl %ebx
call __addvsi2
popl %eax
That would create runtime overhead for normal programs, and
a *lot* of runtime overhead for alogrithms but it would
prevent overflow from causing unpredictable results
(-finline-libgcc-functions anyone ;-). But considering
that most programs (and even most alogrithms) use a fair
amount of constants, constant folding will reduce that
overhead.
Samuel Lauber
--
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.
Powered by Outblaze