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

            Bug ID: 70265
           Summary: ICE on code with constexpr on x86_64-linux-gnu in tree
                    check: expected statement_list, have nop_expr in
                    tsi_start, at tree-iterator.h:42
           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 valid code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It also seems to affect all 5.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 20160317 (experimental) [trunk revision 234278] (GCC) 
$ 
$ g++-trunk -c small.cpp
small2.cpp:10:20:   in constexpr expansion of ‘foo(1)’
small2.cpp:10:33: internal compiler error: tree check: expected statement_list,
have nop_expr in tsi_start, at tree-iterator.h:42
 static_assert (foo (1) == 0, "");
                                 ^
0xfe2bdc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc-source-trunk/gcc/tree.c:9643
0x5d17ff tree_check
        ../../gcc-source-trunk/gcc/tree.h:3006
0x5d17ff tsi_start
        ../../gcc-source-trunk/gcc/tree-iterator.h:42
0x85382f tsi_start
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3105
0x85382f cxx_eval_statement_list
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3136
0x84d024 cxx_eval_loop_expr
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3184
0x84d024 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3842
0x8536b5 cxx_eval_statement_list
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3152
0x84cf3a cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3776
0x84d18a cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3782
0x84c536 cxx_eval_call_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:1393
0x84d46b cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3374
0x850fdd cxx_eval_binary_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:1617
0x84d395 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3624
0x853999 cxx_eval_outermost_constant_expr
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3939
0x85669c maybe_constant_value_1
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4127
0x85669c maybe_constant_value(tree_node*, tree_node*)
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4148
0x7c2465 finish_static_assert(tree_node*, tree_node*, unsigned int, bool)
        ../../gcc-source-trunk/gcc/cp/semantics.c:8681
0x741520 cp_parser_static_assert
        ../../gcc-source-trunk/gcc/cp/parser.c:13050
0x753339 cp_parser_block_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12244
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.
$ 


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


constexpr int
foo (int p)
{
  int t = 0; 
  while (1) 
    ;
  return t;
}

static_assert (foo (1) == 0, "");

Reply via email to