On Fri, Dec 05, 2014 at 01:36:07PM +0100, Martin Liška wrote:
> I've just spent some time hunting memory leaks related to my isolated branch.
> Valgrind reports many following errors:
>
> ==13612== Conditional jump or move depends on uninitialised value(s)
> ==13612== at 0xAC72A4: sparseset_bit_p (sparseset.h:147)
> ==13612== by 0xAC72A4: sparseset_and_compl(sparseset_def*, sparseset_def*,
> sparseset_def*) (sparseset.c:190)
> ==13612== by 0x9B296C: process_bb_lives(basic_block_def*, int&, bool)
> (lra-lives.c:885)
> ==13612== by 0x9B394A: lra_create_live_ranges_1(bool, bool)
> (lra-lives.c:1264)
> ==13612== by 0x9B426F: lra_create_live_ranges(bool, bool)
> (lra-lives.c:1329)
> ==13612== by 0x99B4A3: lra(_IO_FILE*) (lra.c:2350)
> ==13612== by 0x959B79: do_reload (ira.c:5391)
> ==13612== by 0x959B79: (anonymous
> namespace)::pass_reload::execute(function*) (ira.c:5561)
> ==13612== by 0xA22127: execute_one_pass(opt_pass*) (passes.c:2311)
> ==13612== by 0xA225F5: execute_pass_list_1(opt_pass*) (passes.c:2363)
> ==13612== by 0xA22607: execute_pass_list_1(opt_pass*) (passes.c:2364)
> ==13612== by 0xA22648: execute_pass_list(function*, opt_pass*)
> (passes.c:2374)
> ==13612== by 0x726F04: cgraph_node::expand() (cgraphunit.c:1773)
> ==13612== by 0x727BCF: output_in_order(bool) (cgraphunit.c:2011)
>
> Following patch just replaces XNEWVAR with XCNEWVAR and it solves all these
> errors.
> Ready for trunk?
No. sparseset is intentionally uninitialized. If you build with valgrind
checking, sparseset is properly instrumented so that valgrind doesn't
complain, otherwise just ignore those.
Jakub