Bug 58174 - gcc miscompiles code
Summary: gcc miscompiles code
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-16 13:29 UTC by Rafał Mużyło
Modified: 2014-11-26 17:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.7.2, 4.7.3
Known to fail: 4.8.0, 4.8.1
Last reconfirmed: 2013-08-16 00:00:00


Attachments
preprocessed file that miscompiles (80.54 KB, application/x-xz)
2013-08-16 13:29 UTC, Rafał Mużyło
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafał Mużyło 2013-08-16 13:29:06 UTC
Created attachment 30665 [details]
preprocessed file that miscompiles

Using built-in specs.
COLLECT_GCC=gcc-4.8.1
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.8.1/work/gcc-4.8.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-cloog --disable-isl-version-check --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --enable-objc-gc --enable-languages=c,c++,objc,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.1 p1.0, pie-0.5.6' --disable-libstdcxx-pch
Thread model: posix
gcc version 4.8.1 (Gentoo 4.8.1 p1.0, pie-0.5.6)

The command:
gc -DHAVE_INTTYPES=1 -O2 -Wall -Wextra -I/usr/include/SDL -I/usr/include/AL -I/usr/include/libmodplug -o snd_flac.o -c snd_flac.cpp

Notes:
- even '-O' triggers the bug
- at '-O2', for whatever the reason, '-fno-guess-branch-probability' makes things work
Comment 1 Jakub Jelinek 2013-08-16 13:43:21 UTC
Given that the attached testcase isn't self-contained, it would be helpful if you could state where exactly the miscompilation happens, why do you think it is miscompilation and what to look for.
Comment 2 Rafał Mużyło 2013-08-16 14:11:19 UTC
By "miscompiles", in this case I mean there's no error during compilation, but the produced executable fails to work.

I'm not very familiar with the code of the project, that this file comes from, but it's a quite complex bit of C++, which makes it difficult (on my skil level) to tell what exactly goes wrong. I've only managed to find which source file was the apparent culprit of the crash upon running.
Comment 3 Jakub Jelinek 2013-08-16 14:16:26 UTC
Then the report is useless.  I don't think anybody is going to bother verifying the whole compilation unit without knowing what to look for, and with no reproducer there is nothing to do.
Comment 4 Rafał Mużyło 2013-08-16 14:20:26 UTC
How could I narrow it down then ?
Comment 5 Paolo Carlini 2014-11-26 17:36:44 UTC
Feedback not forthcoming.