This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-fwrapv enables some optimizations
- From: Bruno Haible <bruno at clisp dot org>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 20 Dec 2006 15:38:29 +0100
- Subject: -fwrapv enables some optimizations
Hi,
The gcc docs say:
`-fwrapv'
... This flag enables some optimizations and disables others.
-fwrapv turns some undefined behaviour (according to C99) into well-defined
behaviour, therefore it is obvious that it can disable some optimizations.
But the other way around? Without -fwrapv the compiler can assume more
about the program being compiled (namely that signed integer overflows
don't occur), and therefore has more freedom for optimizations. All
optimizations that are possible with -fwrapv should also be performed
without -fwrapv. Anything else is a missed optimization.
One such case is at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30267
but there may be others lurking around.
Bruno