This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/70615] New: ICE on valid code at -O1 and above on x86_64-linux-gnu in add_expr, at tree.c:7870


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

            Bug ID: 70615
           Summary: ICE on valid code at -O1 and above on x86_64-linux-gnu
                    in add_expr, at tree.c:7870
           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 at
-O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

This is a regression from 5.3.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++-trunk -O0 small.cpp
$ g++-5.3 -O1 small.cpp
$ 
$ g++-trunk -O1 small.cpp
small.cpp: In function âint main()â:
small.cpp:26:21: internal compiler error: in add_expr, at tree.c:7870
   (d->*(D_f) fptr) ();
                     ^
0xff677b inchash::add_expr(tree_node const*, inchash::hash&)
        ../../gcc-source-trunk/gcc/tree.c:7870
0xff6297 inchash::add_expr(tree_node const*, inchash::hash&)
        ../../gcc-source-trunk/gcc/tree.c:7882
0xff65f3 inchash::add_expr(tree_node const*, inchash::hash&)
        ../../gcc-source-trunk/gcc/tree.c:7898
0xff6297 inchash::add_expr(tree_node const*, inchash::hash&)
        ../../gcc-source-trunk/gcc/tree.c:7882
0xff612f inchash::add_expr(tree_node const*, inchash::hash&)
        ../../gcc-source-trunk/gcc/tree.c:7843
0xae6148 iterative_hash_expr
        ../../gcc-source-trunk/gcc/tree.h:4759
0xae6148 gimplify_hasher::hash(gimple_temp_hash_elt const*)
        ../../gcc-source-trunk/gcc/gimplify.c:11773
0xae6148 hash_table<gimplify_hasher,
xcallocator>::find_slot(gimple_temp_hash_elt* const&, insert_option)
        ../../gcc-source-trunk/gcc/hash-table.h:414
0xae6148 lookup_tmp_var
        ../../gcc-source-trunk/gcc/gimplify.c:528
0xae6148 internal_get_tmp_var
        ../../gcc-source-trunk/gcc/gimplify.c:563
0xade68e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-source-trunk/gcc/gimplify.c:11213
0xaec501 gimplify_compound_lval
        ../../gcc-source-trunk/gcc/gimplify.c:2114
0xade94e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-source-trunk/gcc/gimplify.c:10229
0xadea6c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-source-trunk/gcc/gimplify.c:10217
0xadecd4 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-source-trunk/gcc/gimplify.c:10992
0xadecd4 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-source-trunk/gcc/gimplify.c:10992
0xaed0b6 gimplify_cond_expr
        ../../gcc-source-trunk/gcc/gimplify.c:3184
0xae0485 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-source-trunk/gcc/gimplify.c:10233
0xae3616 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-source-trunk/gcc/gimplify.c:5684
0xaed41c gimplify_cond_expr
        ../../gcc-source-trunk/gcc/gimplify.c:3143
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 C
{
  virtual void f () {}
};

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

class D : public B, public C
{
public:
  D () {}
};

typedef void (C::*FP) ();
typedef void (D::*D_f) ();

int
main ()
{
  D *d = new D ();
  C *c = d;
  const FP fptr = (FP) & D::f;
  (d->*(D_f) fptr) ();
  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]