ICE on compare of this pointer with reference and throw

Bug #877431 reported by Diederik on 2011-10-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Medium
gcc-4.6 (Ubuntu)
Medium
Unassigned

Bug Description

When compiling the code attached (Note: it has a Qt dependency) 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 gives
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

Diederik (diederikjhattingh) wrote :
In , Djh (djh) wrote :

Created attachment 25624
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.

In , Rguenth (rguenth) wrote :

Please proide preprocessed source of the file that produces this ICE.

In , Djh (djh) wrote :

In the archive, see the file ccjiYBAm.out
If this is not sufficient, I can upload a new one.

In , Redi (redi) wrote :

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

In , Djh (djh) wrote :

Created attachment 25626
Preprocessed source file

Preprocessed file attached as requested.

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.

We have corrupt EH info during cfgcleaup right before expand. Reducing.

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();
    }
}

Matthias Klose (doko) on 2011-12-03
Changed in gcc-4.6 (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed

GCC 4.6.3 is being released.

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Confirmed
Changed in gcc:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.