This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fold x + x to x * 2
On Sat, 6 Nov 2004, Zdenek Dvorak wrote:
> ummm... no I do not (neither does the code for optimizing
> x * c1 + x * c2 to x * (c1 + c2), so I have at least some excuse for
> not noticing it, but of course you are right, it might be better to
> check for it (I am not really sure whether this is an issue; we
> definitely should not create new overflows, but I am not that sure
> about possibly eliminating them).
With -ftrapv, I think any overflow present in the source should result in
a trap on execution. Otherwise, you need only avoid creating overflows.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)