GCC trunk, rev 253367, x86_64. Rev 253307 works fine, so it's a fresh regression. > cat f.cpp bool a; int b; void c() { b &&a <= 0; } > g++ -c f.cpp f.cpp: In function ‘void c()’: f.cpp:3:21: internal compiler error: in decompose, at tree.h:5179 void c() { b &&a <= 0; } ^ 0x6cbe00 wi::int_traits<tree_node const*>::decompose(long*, unsigned int, tree_node const*) ../../gcc/gcc/tree.h:5179 0x6cbe00 wide_int_ref_storage<false>::wide_int_ref_storage<tree_node const*>(tree_node const* const&, unsigned int) ../../gcc/gcc/wide-int.h:976 0x6cbe00 generic_wide_int<wide_int_ref_storage<false> >::generic_wide_int<tree_node const*>(tree_node const* const&, unsigned int) ../../gcc/gcc/wide-int.h:753 0x6cbe00 bool wi::eq_p<generic_wide_int<wide_int_storage>, tree_node const*>(generic_wide_int<wide_int_storage> const&, tree_node const* const&) ../../gcc/gcc/wide-int.h:1760 0x6cbe00 bool generic_wide_int<wide_int_storage>::operator==<tree_node*>(tree_node* const&) const ../../gcc/gcc/wide-int.h:704 0x6cbe00 build_range_check(unsigned int, tree_node*, tree_node*, int, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:4854 0xcd4a08 build_range_check(unsigned int, tree_node*, tree_node*, int, tree_node*, tree_node*) ../../gcc/gcc/fold-const.c:4809 0xb4c404 warn_logical_operator(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node*) ../../gcc/gcc/c-family/c-warn.c:270 0x91af33 build_new_op_1 ../../gcc/gcc/cp/call.c:5978 0x91b42e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../gcc/gcc/cp/call.c:6051 0xabf972 build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int) ../../gcc/gcc/cp/typeck.c:3960 0xa03a2e cp_parser_binary_expression ../../gcc/gcc/cp/parser.c:9274 0xa04f74 cp_parser_assignment_expression ../../gcc/gcc/cp/parser.c:9407 0xa05678 cp_parser_expression ../../gcc/gcc/cp/parser.c:9576 0xa07388 cp_parser_expression_statement ../../gcc/gcc/cp/parser.c:11091 0xa0d543 cp_parser_statement ../../gcc/gcc/cp/parser.c:10907 0xa0e5f0 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:11234 0xa0e6c7 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:11188 0xa2400a cp_parser_function_body ../../gcc/gcc/cp/parser.c:21669 0xa2400a cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:21707 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
Bug seems to occur between revisions 253315 and 253366.
Confirmed, started with r253345.
I'm always willing to take the blame for things I've broken ;-) but... (In reply to Martin Liška from comment #2) > Confirmed, started with r253345. ... that sounds very unlikely. I had a quick look myself, and that would instead point to r253341 for this regression/ICE.
(In reply to Thomas Schwinge from comment #3) > I'm always willing to take the blame for things I've broken ;-) but... > > (In reply to Martin Liška from comment #2) > > Confirmed, started with r253345. > > ... that sounds very unlikely. I had a quick look myself, and that would > instead point to r253341 for this regression/ICE. Sorry, I must have some issue in my bisect script. Thanks.
Author: rsandifo Date: Wed Oct 4 10:50:19 2017 New Revision: 253401 URL: https://gcc.gnu.org/viewcvs?rev=253401&root=gcc&view=rev Log: PR82413: Mismatched precisions in build_range_check build_range_check explicitly allows LOW and HIGH to be a different type from EXP, so we need to use w::to_widest when comparing a value based on HIGH with a value based on EXP's type. 2017-10-04 Richard Sandiford <richard.sandiford@linaro.org> gcc/ PR tree-optimization/82413 * fold-const.c (build_range_check): Use widest_int when comparing the maximum ETYPE value with HIGH. gcc/testsuite/ PR tree-optimization/82413 * g++.dg/pr82413.C: New test. Added: trunk/gcc/testsuite/g++.dg/pr82413.C Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
Patch applied.