Bug 38877

Summary: [4.3 Regression] Revision 143404 caused ICE on 447.dealII in SPEC CPU 2006
Product: gcc Reporter: H.J. Lu <hjl.tools>
Component: c++Assignee: Jason Merrill <jason>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, jason, joey.ye, pinskia, xuepeng.guo
Priority: P1 Keywords: ice-checking, ice-on-valid-code
Version: 4.4.0   
Target Milestone: 4.3.3   
Host: Target:
Build: Known to work: 4.3.2
Known to fail: Last reconfirmed: 2009-01-16 20:41:49

Description H.J. Lu 2009-01-16 19:06:04 UTC
Revision 143404:

http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00780.html

caused

[hjl@gnu-27 build_base_o3.0000]$ /export/gnu/import/rrs/143437/usr/bin/gcc -DSPEC_CPU -DNDEBUG  -Iinclude -DBOOST_DISABLE_THREADS -Ddeal_II_dimension=3  -O2   -DSPEC_CPU_LP64       fe_tools.cc -S
fe_tools.cc: In static member function ‘static std::pair<FiniteElement<dim>*, unsigned int> FETools::get_fe_from_name_aux(const std::string&)’:
fe_tools.cc:1271: internal compiler error: tree check: expected field_decl, have identifier_node in lvalue_p_1, at cp/tree.c:120
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-27 build_base_o3.0000]$ /export/gnu/import/rrs/143437/usr/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --prefix=/export/gnu/import/rrs/143437/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --enable-shared --enable-threads=posix --enable-haifa --enable-checking --enable-languages=c,c++ --disable-bootstrap
Thread model: posix
gcc version 4.4.0 20090116 (experimental) [trunk revision 143437] (GCC) 
[hjl@gnu-27 build_base_o3.0000]$
Comment 1 Jason Merrill 2009-01-16 19:39:50 UTC
Testcase?  I don't have SPEC handy.
Comment 2 H.J. Lu 2009-01-16 19:41:44 UTC
[hjl@gnu-27 build_base_o3.0000]$ cat x.cc
#include <string>
#include <utility>
template <int dim> class bar;

template <int dim>
std::pair<bar<dim> *, unsigned int>
foo (const std::string &name, unsigned int position)
{  
      const std::pair<int,unsigned int> tmp;
      return std::make_pair (new bar<dim>(tmp.first),
			     position);
 }
[hjl@gnu-27 build_base_o3.0000]$ /export/gnu/import/rrs/143437/usr/bin/gcc  -O2 x.cc -S
x.cc: In function ‘std::pair<bar<dim>*, unsigned int> foo(const std::string&, unsigned int)’:
x.cc:10: internal compiler error: tree check: expected field_decl, have identifier_node in lvalue_p_1, at cp/tree.c:120
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-27 build_base_o3.0000]$ 
Comment 3 H.J. Lu 2009-01-16 19:46:21 UTC
[hjl@gnu-27 build_base_o3.0000]$ cat y.cc
template<class _T1, class _T2>
struct pair
{
  typedef _T1 first_type;
  typedef _T2 second_type;
  _T1 first;
  _T2 second;
  pair () : first(), second() { }
  pair(const _T1& __a, const _T2& __b)
    : first(__a), second(__b) { }
};

template<class _T1, class _T2>
inline pair<_T1, _T2>
make_pair(_T1 __x, _T2 __y)
{
    return pair<_T1, _T2>(__x, __y);
}

template <int dim> class bar;

template <int dim>
pair<bar<dim> *, unsigned int>
foo (unsigned int position)
{  
      const pair<int,unsigned int> tmp;
      return make_pair (new bar<dim>(tmp.first),
			     position);
 }
[hjl@gnu-27 build_base_o3.0000]$ /export/gnu/import/rrs/143437/usr/bin/gcc  -O2 y.cc -S
y.cc: In function ‘pair<bar<dim>*, unsigned int> foo(unsigned int)’:
y.cc:27: internal compiler error: tree check: expected field_decl, have identifier_node in lvalue_p_1, at cp/tree.c:120
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-27 build_base_o3.0000]$ 
Comment 4 Jason Merrill 2009-01-16 22:36:48 UTC
Subject: Bug 38877

Author: jason
Date: Fri Jan 16 22:36:32 2009
New Revision: 143446

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143446
Log:
        PR c++/38877
        * tree.c (lvalue_p_1): Allow non-fields in COMPONENT_REF.
        * init.c (build_new): Don't call describable_type unless we
        have an auto.

Added:
    trunk/gcc/testsuite/g++.dg/template/lvalue1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/cp/tree.c

Comment 5 Jason Merrill 2009-01-16 22:40:38 UTC
Subject: Bug 38877

Author: jason
Date: Fri Jan 16 22:40:25 2009
New Revision: 143448

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143448
Log:
        PR c++/38877
        * tree.c (lvalue_p_1): Allow non-fields in COMPONENT_REF.
        * init.c (build_new): Don't call describable_type unless we
        have an auto.

Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 6 Jason Merrill 2009-01-16 22:48:27 UTC
Fixed for 4.4.  Will fix in 4.3 soon.
Comment 7 Richard Biener 2009-01-16 23:11:03 UTC
Patch is ok for the 4.3 branch, adjusting target milestone.
Comment 8 Richard Biener 2009-01-16 23:17:45 UTC
Only happens with checking enabled.
Comment 9 Jason Merrill 2009-01-16 23:17:51 UTC
Subject: Bug 38877

Author: jason
Date: Fri Jan 16 23:17:35 2009
New Revision: 143449

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143449
Log:
        PR c++/38877
        * tree.c (lvalue_p_1): Allow non-fields in COMPONENT_REF.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/lvalue1.C
      - copied unchanged from r143446, trunk/gcc/testsuite/g++.dg/template/lvalue1.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/tree.c

Comment 10 Jason Merrill 2009-01-16 23:18:15 UTC
Fixed.