https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70616

            Bug ID: 70616
           Summary: ICE on valid code on x86_64-linux-gnu in
                    build_base_path, at cp/class.c:303
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current GCC trunk (and
4.7.x and later) on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

This is a regression from 4.6.x. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160409 (experimental) [trunk revision 234848] (GCC) 
$ 
$ g++-4.6 small.cpp
$ 
$ g++-trunk small.cpp
small.cpp: In instantiation of ‘void test() [with int <anonymous> = 0]’:
small.cpp:20:15:   required from here
small.cpp:15:9: internal compiler error: in build_base_path, at cp/class.c:303
   b->~A ();
   ~~~~~~^~
0x6f98e9 build_base_path(tree_code, tree_node*, tree_node*, int, int)
        ../../gcc-source-trunk/gcc/cp/class.c:303
0x612878 build_over_call
        ../../gcc-source-trunk/gcc/cp/call.c:7396
0x61e735 build_new_method_call_1
        ../../gcc-source-trunk/gcc/cp/call.c:8419
0x61e735 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc-source-trunk/gcc/cp/call.c:8489
0x68d380 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:16624
0x67db4f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15802
0x67e1f0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15118
0x67d573 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15104
0x67f090 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15290
0x6c1ef0 instantiate_decl(tree_node*, int, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:22014
0x6c8e72 instantiate_pending_templates(int)
        ../../gcc-source-trunk/gcc/cp/pt.c:22133
0x70aed7 c_parse_final_cleanups()
        ../../gcc-source-trunk/gcc/cp/decl2.c:4599
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


---------------------------------


struct A
{
  virtual ~A () {}
};

struct B : public A
{
  virtual ~B () {}
};

template < int >
void test ()
{
  B *b = new B;
  b->~A ();
} 

int main ()
{
  test < 0 > ();
  return 0; 
}

Reply via email to