This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]