http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56579
Bug #: 56579
Summary: 4.8.0-20130303 g++ optimisation flags cause segfault
or different program output
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: dacr...@gmail.com
Created attachment 29627
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29627
preprocessed version of paq8kx compression program source code
[My first GCC bug report so please kindly point out what
further information you may need. I have tried to adhere
to the instructions at http://gcc.gnu.org/bugs/ Thanks.]
output of g++ -v:
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.8-20130303/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8-20130303/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/usr/local/gcc-4.8-20130303
Thread model: posix
gcc version 4.8.0 20130303 (experimental) (GCC)
Running the compiled program ("./paq8kx somefile") when
compiled with -O3 or -Ofast results in a segfault.
Running when compiled with -O2 no longer segfaults but
produces different program output than expected.
-O1 segfaults
-O0 and Og run and create expected output.
(Note that the above -Ox behaviour is independent of
other compiler flags (including but not limited to -flto),
and can be achieved merely by using -Ox as the sole
differentiator.)
This compares to GCC 4.7.2 and my distro provided
4.4.6, which both produce binaries that do not segfault
at all and also generate identical program output
irrespective of -O option chosen at compile time.
Running the program author's pre-compiled binary
likewise matches 4.7.2 and 4.4.6 behaviour and output.
This is the only program that I've compiled using GCC
4.8 that does not run as expected; all others run fine.
It therefore appears that 4.8.0's optimizer is being
tripped up by something in paq8kx.