[Bug other/56579] 4.8.0-20130303 g++ optimisation flags cause segfault or different program output

markus at trippelsdorf dot de gcc-bugzilla@gcc.gnu.org
Sat Mar 9 16:22:00 GMT 2013


Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #2 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2013-03-09 16:22:19 UTC ---
(In reply to comment #1)
> Something in the back of my mind has since reminded
> me of -fno-aggressive-loop-optimizations, and compiling
> at (e.g.) -O3 using -fno-aggressive-loop-optimizations
> no longer segfaults and produces the expected output.

That most likely means that the programm is invoking undefined
behaviour and thus invalid.

A quick check with "clang++ -fsanitize=undefined" confirms this:
 paq8kx_v7.cpp:1795:13: fatal error: signed integer overflow: 707863021 * 8
cannot be represented in type 'int'

More information about the Gcc-bugs mailing list