Created attachment 23963 [details] unfiltered source file (after preprocessor) requires -mavx to compile with data/newusr/bin/g++ -v Using built-in specs. COLLECT_GCC=/data/newusr/bin/g++ COLLECT_LTO_WRAPPER=/data/newusr/libexec/gcc/x86_64-unknown-linux-gnu/4.6.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ./configure --prefix=/data/newusr -enable-gold=yes --enable-lto --with-fpmath=avx --with-build-config=bootstrap-lto --with-gmp-lib=/usr/local/lib64 --with-mpfr-lib=/usr/local/lib64 -with-mpc-lib=/usr/local/lib64 Thread model: posix gcc version 4.6.1 20110408 (prerelease) (GCC) (and 20110401) I get /data/newusr/bin/g++ -c produceICE.ii -std=c++0x -Wall -mavx In file included from /data/CMSSW_4_2_0_pre6/src/CommonTools/RecoAlgos/plugins/EtaPtMinGsfElectronFullCloneSelector.cc:16:0: /data/CMSSW_4_2_0_pre6/src/CommonTools/RecoAlgos/interface/GsfElectronSelector.h: In member function 'void helper::GsfElectronCollectionStoreManager::cloneAndStore(const I&, const I&, edm::Event&)': /data/CMSSW_4_2_0_pre6/src/CommonTools/RecoAlgos/interface/GsfElectronSelector.h:49:60: internal compiler error: Segmentation fault This the first serious ICE I got compiling many 1000 of source units. It compiles fine with g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0 --enable-languages=c,c++,fortran --with-gmp=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0 --with-mpfr=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0 --with-mpc=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0 --with-ppl=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0 --with-cloog=/build/460e/slc5_amd64_gcc460/external/gcc/4.6.0 --enable-cloog-backend=isl --enable-shared CC='gcc -fPIC' CXX='c++ -fPIC' Thread model: posix gcc version 4.6.0 (GCC)
Confirmed. Works with r171596. #0 0x00000000005fad6b in fixed_type_or_null (instance=0x7fffeb1116c0, nonnull=0x0, cdtorp=0x7fffffffb25c) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/class.c:5828 #1 0x00000000005fc452 in fixed_type_or_null (instance=0x7fffeb10c460, nonnull=0x0, cdtorp=0x7fffffffb25c) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/class.c:5947 #2 0x00000000005fae8e in fixed_type_or_null (instance=0x7fffeb111900, nonnull=0x0, cdtorp=0x7fffffffb25c) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/class.c:5831 #3 0x00000000005fc5a9 in resolves_to_fixed_type_p (instance=0x7fffeb111900, nonnull=0x0) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/class.c:5980 #4 0x00000000004c28f9 in build_new_method_call (instance=0x7fffeb111900, fns=0x7fffebffbf00, args=0x7fffffffb888, conversion_path=0x7fffebff40d0, flags=3, fn_p=0x0, complain=3) at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cp/call.c:6978 (gdb) l 5823 #define RECUR(T) fixed_type_or_null((T), nonnull, cdtorp) 5824 5825 switch (TREE_CODE (instance)) 5826 { 5827 case INDIRECT_REF: 5828 if (POINTER_TYPE_P (TREE_TYPE (instance))) 5829 return NULL_TREE; 5830 else 5831 return RECUR (TREE_OPERAND (instance, 0)); 5832 (gdb) p instance->base.code $3 = INDIRECT_REF (gdb) p instance->common.type $4 = (tree) 0x0 Reducing.
while looking for a work-around I discovered that sed -i 's/const GsfElectron & ele =/GsfElectron ele =/g' produceICE.ii that affects line grep -n "const GsfElectron & ele =" produceICE.ii 185392: const GsfElectron & ele = * * i; "make it compiling"
sorry Richard, I suspect I've overwritten your changes by mistake vincenzo On 12 Apr, 2011, at 4:52 PM, rguenth at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48574 > > Richard Guenther <rguenth at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Priority|P3 |P1 > Target Milestone|--- |4.6.1 > Summary|ICE (regression w.r.t. |[4.6/4.7 Regression] ICE > |4.6.0) |(regression w.r.t. 4.6.0) > Known to fail| |4.6.1, 4.7.0 > > -- > Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug.
Likely constexpr related, running delta now to reduce it a little bit.
Reduction is running slowly. Anyway, this started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171461 i.e. PR48289 fix.
Reduced testcase (ICEs even with no options): struct A { virtual void foo (); }; template <typename T> void bar (T x) { A &b = *x; b.foo (); }
--- gcc/cp/class.c.jj 2011-03-31 08:50:52.000000000 +0200 +++ gcc/cp/class.c 2011-04-13 09:41:42.000000000 +0200 @@ -5827,7 +5827,8 @@ fixed_type_or_null (tree instance, int * switch (TREE_CODE (instance)) { case INDIRECT_REF: - if (POINTER_TYPE_P (TREE_TYPE (instance))) + if ((processing_template_decl && TREE_TYPE (instance) == NULL_TREE) + || POINTER_TYPE_P (TREE_TYPE (instance))) return NULL_TREE; else return RECUR (TREE_OPERAND (instance, 0)); fixes the ICE, but I doubt it is the right fix. I think other dependent types (e.g. TEMPLATE_TYPE_PARM or TEMPLATE_TEMPLATE_PARM at least) can be potentially a POINTER_TYPE_P too. On the other side calling dependent_type_p (TREE_TYPE (instance)) || POINTER_TYPE_P (TREE_TYPE (instance))) here would return NULL even for dependent types that will certainly not be POINTER_TYPE_Ps.
Candidate patch proposed at http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00985.html
Author: dodji Date: Wed Apr 13 15:09:26 2011 New Revision: 172375 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172375 Log: Fix PR c++/48574 gcc/cp/ * class.c (fixed_type_or_null): We cannot determine the dynamic type of a reference variable if its initializer is dependent. gcc/testsuite/ * g++.dg/template/dependent-expr7.C: New test case. Added: trunk/gcc/testsuite/g++.dg/template/dependent-expr7.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/testsuite/ChangeLog
Fixed in 4.7 (trunk)
Author: dodji Date: Wed Apr 13 15:19:40 2011 New Revision: 172376 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172376 Log: Fix PR c++/48574 gcc/cp/ * class.c (fixed_type_or_null): We cannot determine the dynamic type of a reference variable if its initializer is dependent. gcc/testsuite/ * g++.dg/template/dependent-expr7.C: New test case. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/dependent-expr7.C Modified: branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/class.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Fixed in 4.6.1
is this really fixed? with gcc version 4.6.1 20110422 (prerelease) (GCC) the reduced test do compile but I still get g++ -c produceICE.ii -std=c++0x -Wall -mavx In file included from /data/CMSSW_4_2_0_pre6/src/CommonTools/RecoAlgos/plugins/EtaPtMinGsfElectronFullCloneSelector.cc:16:0: /data/CMSSW_4_2_0_pre6/src/CommonTools/RecoAlgos/interface/GsfElectronSelector.h: In member function 'void helper::GsfElectronCollectionStoreManager::cloneAndStore(const I&, const I&, edm::Event&)': /data/CMSSW_4_2_0_pre6/src/CommonTools/RecoAlgos/interface/GsfElectronSelector.h:54:36: internal compiler error: Segmentation fault Please submit a full bug report,
I can confirm that the original testcase still ICEs, both mainline and branch.
Indeed, unlike the reduced testcase, for the original one it triggers during fold_non_dependent_expr_sfinae which means that processing_template_decl is 0 and thus type_dependent_expression_p check Dodji added returns false immediately. Related to PR48749, where processing_template_decl is 1, but type_dependent_expression_p is still false, because the COMPONENT_REF has non-dependent type, yet its operands are dependent (it was created using build_min_non_dep).
Indeed. I haven't re-checked the initial test case; I have only considered the reduced one. Sorry, my bad. I am looking into this.
I think the reduced test case below reflects the ICE of the original test case. It needs the -std=c++0x option. struct A { virtual int foo(); }; void baz (int); template <typename T> void bar(T x) { A &b = *x; baz (b.foo ()); } void foo() { A a; bar(&a); }
Candidate patch posted to http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00474.html
Author: dodji Date: Mon May 9 12:32:06 2011 New Revision: 173570 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173570 Log: Fix PR c++/48574 gcc/cp/ PR c++/48574 * class.c (fixed_type_or_null): Use type_dependent_p_push to test if the instance has a dependent initializer. gcc/testsuite/ PR c++/48574 * g++.dg/template/dependent-expr8.C: New test case. Added: trunk/gcc/testsuite/g++.dg/template/dependent-expr8.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/testsuite/ChangeLog
Author: dodji Date: Mon May 9 12:34:19 2011 New Revision: 173571 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173571 Log: Fix PR c++/48574 gcc/cp/ PR c++/48574 * class.c (fixed_type_or_null): Use type_dependent_p_push to test if the instance has a dependent initializer. gcc/testsuite/ PR c++/48574 * g++.dg/template/dependent-expr8.C: New test case. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/dependent-expr8.C Modified: branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/class.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Fixed.