Bug 50881 - [4.6 Regression] ICE Segfault on compare this pointer with reference
Summary: [4.6 Regression] ICE Segfault on compare this pointer with reference
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.1
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-27 07:29 UTC by Diederik
Modified: 2013-04-12 16:18 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.5.3
Known to fail: 4.6.1
Last reconfirmed: 2011-10-27 00:00:00


Attachments
Program that causes ICE (64.60 KB, application/x-gzip)
2011-10-27 07:29 UTC, Diederik
Details
Preprocessed source file (62.67 KB, application/octet-stream)
2011-10-27 10:18 UTC, Diederik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Diederik 2011-10-27 07:29:43 UTC
Created attachment 25624 [details]
Program that causes ICE

When compiling the code attached (Note: it has a Qt dependency (sorry) ) the compiler crashes with the following output:
$ make
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o test2.o test2.cpp
test2.cpp:19:5: warning: unused parameter ‘argc’ [-Wunused-parameter]
test2.cpp:19:5: warning: unused parameter ‘arcv’ [-Wunused-parameter]
test2.cpp: In constructor ‘CompareThisRefICE::CompareThisRefICE()’:
test2.cpp:9:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccjiYBA.out file, please attach this to your bugreport.
make: *** [test2.o] Error 1

Was reproduced with Qt 4.5.2 and Qt 4.7.4 on gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

I recently upgraded to Ubuntu 11.10.

uname -a
Linux djh-emssnew 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

I have logged it with Ubuntu first (https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/877431) but no activity for more than a week.
Comment 1 Richard Biener 2011-10-27 09:17:21 UTC
Please proide preprocessed source of the file that produces this ICE.
Comment 2 Diederik 2011-10-27 09:26:41 UTC
In the archive, see the file ccjiYBAm.out
If this is not sufficient, I can upload a new one.
Comment 3 Jonathan Wakely 2011-10-27 10:00:39 UTC
That file is sufficient, but please attach it separately (the instructions at http://gcc.gnu.org/bugs/ are pretty clear about wanting preprocessed source not an archive that we need to extract to find the right file).

N.B. preprocessed C++ source should use the extension .ii so GCC knows what to do with it, see http://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html - if you use -save-temps as suggested at http://gcc.gnu.org/bugs/ then that file is created automatically
Comment 4 Diederik 2011-10-27 10:18:18 UTC
Created attachment 25626 [details]
Preprocessed source file

Preprocessed file attached as requested.
Comment 5 Paolo Carlini 2011-10-30 10:12:35 UTC
Richard I just checked the preprocessed (on x86_64 -m32) and apparently mainline is Ok, 4_6-branch Seg Faults at tree-cfg.c:1083, I'm not sure it's a C++ issue.
Comment 6 Paolo Carlini 2011-10-30 10:14:40 UTC
Oops.
Comment 7 Richard Biener 2011-11-02 08:57:50 UTC
We have corrupt EH info during cfgcleaup right before expand.  Reducing.
Comment 8 Richard Biener 2011-11-02 09:02:16 UTC
Reduced testcase:

class CompareThisRefICE {
    CompareThisRefICE();
};
typedef unsigned short ushort;
class __attribute__((visibility("default"))) QString {
public:
    ~QString();
    inline QString(const char *ch) : d(fromAscii_helper(ch))     { }
    struct Data { ushort righttoleft : 11; };
    Data *d;
    static Data *fromAscii_helper(const char *str, int size = -1);
};
class B { };
CompareThisRefICE::CompareThisRefICE() {
    CompareThisRefICE t;
    if (!(this != &t))     {
        QString b("boom");
        throw B();
    }
}
Comment 9 Jakub Jelinek 2012-03-01 14:39:26 UTC
GCC 4.6.3 is being released.
Comment 10 Jakub Jelinek 2013-04-12 16:18:04 UTC
The 4.6 branch has been closed, fixed in GCC 4.7.0.