[Bug c/30475] assert(int+100 > int) optimized away
felix-gcc at fefe dot de
gcc-bugzilla@gcc.gnu.org
Wed Jan 17 19:04:00 GMT 2007
------- Comment #25 from felix-gcc at fefe dot de 2007-01-17 19:04 -------
Well, duh. You removed the security checks.
Hey, I have one for you, too. Optimize away all calls to pthread_mutex_lock,
and lo and behold, multithreaded code will be much faster! It will also be
broken, but apparently, that's not much of a concern around here.
The most time critical code I have, I just benchmarked.
$ gcc -O3 -fomit-frame-pointer -funroll-loops -march=athlon64 -o t t.c misc.c
add.c mul.c write.c read.c comba.c
$ ./t
adding two bignums: 84 cycles
multiply two bignums: 1414 cycles
writing a bignum as radix 10: 207488 cycles
comba: 1467 cycles
$ gcc -O3 -fomit-frame-pointer -funroll-loops -march=athlon64 -o t t.c misc.c
add.c mul.c write.c read.c comba.c -fwrapv
adding two bignums: 82 cycles
multiply two bignums: 1414 cycles
writing a bignum as radix 10: 202761 cycles
comba: 1465 cycles
$
So, uh, where does the optimization part about your "optimization" come in?
This is code that has no integer overflow checks. So my conjecture is: your
"optimization" makes code faster in exactly those cases where it removes
security checks from it, endangering people on the way.
So, again, please make -fwrapv the default, and I'll leave you alone.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475
More information about the Gcc-bugs
mailing list