http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56532



             Bug #: 56532

           Summary: valgrind errors with -flto

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: lto

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ja...@gcc.gnu.org





valgrind --leak-check=full --track-origins=yes --db-attach=yes ./cc1plus

pr46984.C -O -fipa-cp -fno-early-inlining -flto -quiet

gives:

==5852== Conditional jump or move depends on uninitialised value(s)

==5852==    at 0x1205C84: bp_pack_var_len_unsigned(bitpack_d*, unsigned long)

(data-streamer.c:36)

==5852==    by 0xB2144D: lto_output_edge(lto_simple_output_block*,

cgraph_edge*, lto_symtab_encoder_d*) (lto-cgraph.c:277)

==5852==    by 0xB2285F: output_outgoing_cgraph_edges(cgraph_edge*,

lto_simple_output_block*, lto_symtab_encoder_d*) (lto-cgraph.c:651)

==5852==    by 0xB22F9E: output_symtab() (lto-cgraph.c:840)

==5852==    by 0xB2DCD1: lto_output() (lto-streamer-out.c:1000)

==5852==    by 0xB730F7: ipa_write_summaries_2(opt_pass*, lto_out_decl_state*)

(passes.c:2408)

==5852==    by 0xB731E6: ipa_write_summaries_1(lto_symtab_encoder_d*)

(passes.c:2438)

==5852==    by 0xB733B6: ipa_write_summaries() (passes.c:2492)

==5852==    by 0x893292: ipa_passes() (cgraphunit.c:1905)

==5852==    by 0x8936B7: compile() (cgraphunit.c:1991)

==5852==    by 0x8939B7: finalize_compilation_unit() (cgraphunit.c:2119)

==5852==    by 0x647071: cp_write_global_declarations() (decl2.c:4318)

==5852==  Uninitialised value was created by a client request

==5852==    at 0x7F654A: ggc_internal_alloc_stat(unsigned long)

(ggc-page.c:1339)

==5852==    by 0x886F18: cgraph_create_edge_1(cgraph_node*, cgraph_node*,

gimple_statement_d*, long, int) (cgraph.c:793)

==5852==    by 0x88714F: cgraph_create_edge(cgraph_node*, cgraph_node*,

gimple_statement_d*, long, int) (cgraph.c:838)

==5852==    by 0x88F6BF: cgraph_analyze_function(cgraph_node*)

(cgraphunit.c:630)

==5852==    by 0x8906C8: cgraph_analyze_functions() (cgraphunit.c:964)

==5852==    by 0x8939A8: finalize_compilation_unit() (cgraphunit.c:2110)

==5852==    by 0x647071: cp_write_global_declarations() (decl2.c:4318)

==5852==    by 0xC63E12: compile_file() (toplev.c:557)

==5852==    by 0xC65DB5: do_compile() (toplev.c:1876)

==5852==    by 0xC65F20: toplev_main(int, char**) (toplev.c:1952)

==5852==    by 0x12EC1CD: main (main.c:36)



273  uid = (!gimple_has_body_p (edge->caller->symbol.decl)

274 ? edge->lto_stmt_uid : gimple_uid (edge->call_stmt));



gimple_has_body_p is false (edge->call_stmt is NULL, DECL_STRUCT_FUNCTION

(edge->caller->symbol.decl) is NULL), and lto_stmt_uid is clearly

uninitialized.



When run under gdb rather than valgrind where you can't make interior calls:

b lto-cgraph.c:273 if !gimple_has_body_p (edge->caller->symbol.decl) &&

edge->lto_stmt_uid == 0xafafafaf

shows

(gdb) p debug_generic_stmt (edge->caller->symbol.decl)

_ZThn528_N1D3fooEv

(gdb) p debug_generic_stmt (edge->callee->symbol.decl)

*.LTHUNK0



Which also shows why I haven't seen any such failures in

gcc/testsuite/gcc/gcc.log, while tons of them in gcc/testsuite/g++/g++.log -

bet only thunks don't have body here and the code doesn't count with those.

Reply via email to