https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71561
Bug ID: 71561 Summary: ICE with -Wall on valid C++ code on x86_64-linux-gnu: in potential_constant_expression_1, at cp/constexpr.c:5249 Product: gcc Version: 7.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 with -Wall on x86_64-linux-gnu in both 32-bit and 64-bit modes. It also seems to affect 5.x and later, and is a regression from 4.9.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/7.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 7.0.0 20160616 (experimental) [trunk revision 237533] (GCC) $ $ g++-trunk -c small.cpp $ g++-4.9 -c -Wall small.cpp small.cpp: In function ‘void foo()’: small.cpp:3:25: warning: statement has no effect [-Wunused-value] 0 && ({ goto L1; 0; }); ^ $ $ g++-trunk -c -Wall small.cpp small.cpp: In function ‘void foo()’: small.cpp:3:24: internal compiler error: in potential_constant_expression_1, at cp/constexpr.c:5249 0 && ({ goto L1; 0; }); ^ 0x8b1f27 potential_constant_expression_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:5249 0x8b1adf potential_constant_expression_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:4854 0x8b2df3 potential_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:5269 0x8b2df3 potential_nondependent_constant_expression(tree_node*) ../../gcc-source-trunk/gcc/cp/constexpr.c:5311 0x8b3b92 maybe_constant_value_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:4395 0x8b3b92 maybe_constant_value(tree_node*, tree_node*) ../../gcc-source-trunk/gcc/cp/constexpr.c:4429 0x7d4252 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/typeck.c:5119 0x7e1853 ocp_convert(tree_node*, tree_node*, int, int, int) ../../gcc-source-trunk/gcc/cp/cvt.c:800 0x7e356c cp_convert ../../gcc-source-trunk/gcc/cp/cvt.c:616 0x7e356c cp_convert_and_check(tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/cvt.c:635 0x7d3db3 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/typeck.c:5140 0x67bc1a build_new_op_1 ../../gcc-source-trunk/gcc/cp/call.c:5849 0x67ccfe build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../gcc-source-trunk/gcc/cp/call.c:5894 0x7c0852 build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int) ../../gcc-source-trunk/gcc/cp/typeck.c:3889 0x797ae6 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8921 0x798240 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9053 0x79ab39 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9220 0x79b15f cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10681 0x7a9f9b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10532 0x7aac5c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10804 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. $ -------------------------------- void foo () { 0 && ({ goto L1; 0; }); L1:; }