https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78583
Bug ID: 78583 Summary: ICE on valid C code at -O3 on x86_64-linux-gnu (internal compiler error: in simplify_truncation) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-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 20161129 (experimental) [trunk revision 242953] (GCC) $ $ $ gcc-trunk -O3 small.c small.c: In function ‘main’: small.c:10:1: internal compiler error: in simplify_truncation, at simplify-rtx.c:640 } ^ 0xbc17bc simplify_truncation ../../gcc-source-trunk/gcc/simplify-rtx.c:640 0xbc069e simplify_unary_operation_1 ../../gcc-source-trunk/gcc/simplify-rtx.c:1193 0xbc069e simplify_unary_operation(rtx_code, machine_mode, rtx_def*, machine_mode) ../../gcc-source-trunk/gcc/simplify-rtx.c:877 0xbc1070 simplify_gen_unary(rtx_code, machine_mode, rtx_def*, machine_mode) ../../gcc-source-trunk/gcc/simplify-rtx.c:384 0xbc12a5 simplify_truncation ../../gcc-source-trunk/gcc/simplify-rtx.c:773 0xbc21e8 simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned int) ../../gcc-source-trunk/gcc/simplify-rtx.c:6259 0x12a4f2e gen_lowpart_for_combine ../../gcc-source-trunk/gcc/combine.c:11465 0x12a65d3 get_last_value ../../gcc-source-trunk/gcc/combine.c:13373 0x12a6671 if_then_else_cond ../../gcc-source-trunk/gcc/combine.c:9165 0x12a6749 if_then_else_cond ../../gcc-source-trunk/gcc/combine.c:9035 0x12a6732 if_then_else_cond ../../gcc-source-trunk/gcc/combine.c:9034 0x12b3d0d combine_simplify_rtx ../../gcc-source-trunk/gcc/combine.c:5604 0x12b6572 subst ../../gcc-source-trunk/gcc/combine.c:5487 0x12b6228 subst ../../gcc-source-trunk/gcc/combine.c:5432 0x12b604a subst ../../gcc-source-trunk/gcc/combine.c:5355 0x12b784a try_combine ../../gcc-source-trunk/gcc/combine.c:3272 0x12bd181 combine_instructions ../../gcc-source-trunk/gcc/combine.c:1265 0x12bd181 rest_of_handle_combine ../../gcc-source-trunk/gcc/combine.c:14581 0x12bd181 execute ../../gcc-source-trunk/gcc/combine.c:14626 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. $ $ cat small.c int a[1]; int b; unsigned short c; void fn1(int p1) { b = a[a[a[a[a[a[a[a[b ^ p1]]]]]]]]; } int main() { long d = c; fn1(d & d >> 8 & 5); return 0; } $