https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64003
Bug ID: 64003 Summary: valgrind complains about get_attr_length_nobnd in insn-attrtab.c from i386.md Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu Build: x86_64-unknown-linux-gnu Created attachment 34057 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34057&action=edit Reproducer When I run the jit testsuite under valgrind I consistently see reports from here: Conditional jump or move depends on uninitialised value(s) at 0x5721AED: get_attr_length_nobnd(rtx_insn*) (i386.md:6236) by 0x5715F3A: insn_min_length(rtx_insn*) (i386.md:510) by 0x4F4BE0A: shorten_branches(rtx_insn*) (final.c:1208) by 0x4F52A5A: rest_of_handle_shorten_branches() (final.c:4567) by 0x4F52AAE: (anonymous namespace)::pass_shorten_branches::execute(function*) (final.c:4596) by 0x522354D: execute_one_pass(opt_pass*) (passes.c:2306) by 0x52237C4: execute_pass_list_1(opt_pass*) (passes.c:2358) by 0x52237F5: execute_pass_list_1(opt_pass*) (passes.c:2359) by 0x52237F5: execute_pass_list_1(opt_pass*) (passes.c:2359) by 0x5223832: execute_pass_list(function*, opt_pass*) (passes.c:2369) by 0x4E4884F: cgraph_node::expand() (cgraphunit.c:1773) by 0x4E48EE9: expand_all_functions() (cgraphunit.c:1909) I can reproduce this with cc1 with the attached file at -O2 and above: valgrind ./cc1 get-attr-length-i386.c -O2 This is with r217427 on x86_64-unknown-linux-gnu, configuring with: --enable-valgrind-annotations Turning off the writing of #line directives in read-md.c shows that it's at line 18500 of the generated insn-attrtab.c: ==5819== at 0xD952E2: get_attr_length_nobnd(rtx_insn*) (insn-attrtab.c:18500) somewhere within this monster conditional: 18493 int 18494 get_attr_length_nobnd (rtx_insn *insn ATTRIBUTE_UNUSED) 18495 { 18496 switch (recog_memoized (insn)) 18497 { 18498 case 610: /* *jcc_1 */ 18499 extract_insn_cached (insn); >18500 if ((((INSN_ADDRESSES_SET_P () ? INSN_ADDRESSES (INSN_UID >(GET_CODE (operands[0]) == LABEL_REF ? XEXP (operands[0], 0) : operands[0])) : >0) - (insn_current_reference_address (insn))) >= (-126)) && >(((INSN_ADDRESSES_SET_P () ? INSN_ADDRESSES (INSN_UID (GET_CODE (operands[0]) >== LABEL_REF ? XEXP (operands[0], 0) : operands[0])) : 0) - >(insn_current_reference_address (insn))) < (128)))