https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68805
Bug ID: 68805 Summary: ICE while var-tracking in simplify_binary_operation_1 with -g and -mvsx-timode Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bergner at gcc dot gnu.org Target Milestone: --- We ICE while in the var tracking pass with the following reduced testcase. bergner@genoa:~/gcc/BUGS/ICE$ cat bug.ii struct A { int first; int *second; }; class B { typedef A &const_reference; typedef A *iterator; public: iterator end(); void insert(iterator, const_reference); void push_back(const_reference p1) { *end() = p1; insert(0, p1); } }; void foo (void) { B blocks; A a; blocks.push_back(a); } bergner@genoa:~/gcc/BUGS/ICE$ ${BLD}/gcc/xg++ -B${BLD}/gcc -S -O1 -g -mvsx-timode bug.ii bug.ii: In function ‘void foo()’: bug.ii:24:1: internal compiler error: in simplify_binary_operation_1, at simplify-rtx.c:3372 } ^ ... If I remove either the -g or -mvsx-timode options, then we compile fine. We hit the following assert: case VEC_SELECT: if (!VECTOR_MODE_P (mode)) { gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0))); Since mode (TImode) isn't a vector mode and trueop0 is also of TImode and hence not a vector mode, so boom! Some debugger info: (gdb) bt #0 fancy_abort (file=0x11cbc3d0 "/home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c", line=3372, function=0x11cbc6f8 <simplify_binary_operation_1(rtx_code, machine_mode, rtx_def*, rtx_def*, rtx_def*, rtx_def*)::__FUNCTION__> "simplify_binary_operation_1") at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/diagnostic.c:1332 #1 0x0000000010f31388 in simplify_binary_operation_1 (code=VEC_SELECT, mode=TImode, op0=0x3fffb54cf108, op1=0x3fffb5536540, trueop0=0x3fffb54cf108, trueop1=0x3fffb5536540) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c:3372 #2 0x0000000010f2aa08 in simplify_binary_operation (code=VEC_SELECT, mode=TImode, op0=0x3fffb54cf108, op1=0x3fffb5536540) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c:2028 #3 0x0000000010f22dfc in simplify_gen_binary (code=VEC_SELECT, mode=TImode, op0=0x3fffb54cf108, op1=0x3fffb5536540) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c:184 #4 0x0000000010f23d64 in simplify_replace_fn_rtx (x=0x3fffb54cdcc8, old_rtx=0x0, fn=0x1144f3e4 <adjust_mems(rtx, const_rtx, void*)>, data=0x3fffffffed98) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c:459 #5 0x000000001145004c in adjust_mem_uses (x=0x3fffb54cdcf0, data=0x3fffffffed98) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:1158 #6 0x0000000010eb1964 in note_uses (pbody=0x3fffb56fa9a0, fun=0x11450008 <adjust_mem_uses(rtx*, void*)>, data=0x3fffffffed98) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/rtlanal.c:1934 #7 0x0000000011450500 in adjust_insn (bb=0x3fffb55f0958, insn=0x3fffb56fa980) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:1271 #8 0x0000000011472e44 in vt_initialize () at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:10025 #9 0x0000000011473a2c in variable_tracking_main_1 () at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:10227 #10 0x0000000011473c08 in variable_tracking_main () at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:10280 #11 0x0000000011473d60 in (anonymous namespace)::pass_variable_tracking::execute (this=0x123c4cf0) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:10317 #12 0x0000000010dd53c0 in execute_one_pass (pass=0x123c4cf0) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/passes.c:2336 #13 0x0000000010dd586c in execute_pass_list_1 (pass=0x123c4cf0) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/passes.c:2410 #14 0x0000000010dd58ac in execute_pass_list_1 (pass=0x123c4c30) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/passes.c:2411 #15 0x0000000010dd58ac in execute_pass_list_1 (pass=0x123c3190) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/passes.c:2411 #16 0x0000000010dd5944 in execute_pass_list (fn=0x3fffb5735940, pass=0x123bfd20) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/passes.c:2421 #17 0x000000001086a578 in cgraph_node::expand (this=0x3fffb5560e60) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/cgraphunit.c:1971 #18 0x000000001086adf8 in expand_all_functions () at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/cgraphunit.c:2107 #19 0x000000001086beec in symbol_table::compile (this=0x3fffb5500000) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/cgraphunit.c:2456 #20 0x000000001086c228 in symbol_table::finalize_compilation_unit (this=0x3fffb5500000) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/cgraphunit.c:2546 #21 0x0000000010f6f25c in compile_file () at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/toplev.c:489 #22 0x0000000010f734d4 in do_compile () at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/toplev.c:1977 #23 0x0000000010f73980 in toplev::main (this=0x3ffffffff4be, argc=15, argv=0x3ffffffff8d8) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/toplev.c:2084 #24 0x0000000011b0cdb8 in main (argc=15, argv=0x3ffffffff8d8) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/main.c:39 (gdb) frame 7 #7 0x0000000011450500 in adjust_insn (bb=0x3fffb55f0958, insn=0x3fffb56fa980) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:1271 1271 note_uses (&PATTERN (insn), adjust_mem_uses, &amd); (gdb) pr insn (insn 24 22 25 2 (set (reg:TI 32 0 [orig:161 a ] [161]) (vec_select:TI (mem/c:TI (plus:DI (reg/f:DI 1 1) (reg:DI 9 9 [159])) [1 a+0 S16 A64]) (parallel [ (const_int 1 [0x1]) (const_int 0 [0]) ]))) bug.ii:13 1072 {*vsx_lxvd2x2_le_ti} (expr_list:REG_DEAD (reg:DI 9 9 [159]) (nil))) (gdb) frame 5 #5 0x000000001145004c in adjust_mem_uses (x=0x3fffb54cdcf0, data=0x3fffffffed98) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/var-tracking.c:1158 1158 rtx new_x = simplify_replace_fn_rtx (*x, NULL_RTX, adjust_mems, data); (gdb) pr *x (vec_select:TI (mem/c:TI (plus:DI (reg/f:DI 1 1) (reg:DI 9 9 [159])) [1 a+0 S16 A64]) (parallel [ (const_int 1 [0x1]) (const_int 0 [0]) ])) (gdb) frame 3 #3 0x0000000010f22dfc in simplify_gen_binary (code=VEC_SELECT, mode=TImode, op0=0x3fffb54cf108, op1=0x3fffb5536540) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c:184 184 tem = simplify_binary_operation (code, mode, op0, op1); (gdb) pr op0 (mem/c:TI (plus:DI (plus:DI (reg/f:DI 67 ap) (reg:DI 9 9 [159])) (const_int -64 [0xffffffffffffffc0])) [1 a+0 S16 A64]) (gdb) pr op1 (parallel [ (const_int 1 [0x1]) (const_int 0 [0]) ]) (gdb) frame 1 #1 0x0000000010f31388 in simplify_binary_operation_1 (code=VEC_SELECT, mode=TImode, op0=0x3fffb54cf108, op1=0x3fffb5536540, trueop0=0x3fffb54cf108, trueop1=0x3fffb5536540) at /home/bergner/gcc/gcc-fsf-mainline-bootstrap-lra-default/gcc/simplify-rtx.c:3372 3372 gcc_assert (VECTOR_MODE_P (GET_MODE (trueop0))); (gdb) pr trueop0 (mem/c:TI (plus:DI (plus:DI (reg/f:DI 67 ap) (reg:DI 9 9 [159])) (const_int -64 [0xffffffffffffffc0])) [1 a+0 S16 A64]) (gdb) pr trueop1 (parallel [ (const_int 1 [0x1]) (const_int 0 [0]) ])