Skip to content

Conditional jump or move depends on uninitialized value in rustc #374

Closed
@brson

Description

@brson

Running make stage2/std.o VALGRIND_COMPILE=1 on Linux reports the following:

==15459== Conditional jump or move depends on uninitialised value(s)
==15459==    at 0x80DA7CD: _rust_fn960_middle_ty_ty_to_str (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x8072DA6: _rust_fn730_middle_trans_make_scalar_cmp_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x80709E0: _rust_fn728_middle_trans_make_cmp_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x806C938: _rust_fn715_middle_trans_make_generic_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x807CA3E: _rust_fn747_middle_trans_lazily_emit_tydesc_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x807E196: _rust_fn751_middle_trans_call_cmp_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x8072603: _rust_fn729_middle_trans_make_cmp_glue_inner (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x83651CE: _rust_thunk3515_middle_trans_make_cmp_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x807584E: _rust_fn738_middle_trans_iter_structural_ty_full (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x807163C: _rust_fn728_middle_trans_make_cmp_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x806C938: _rust_fn715_middle_trans_make_generic_glue (in /home/brian/Dev/rust/build/stage1/rustc)
==15459==    by 0x807CA3E: _rust_fn747_middle_trans_lazily_emit_tydesc_glue (in /home/brian/Dev/rust/build/stage1/rustc)

I believe this test case reproduces the issue although the error manifests in a different way (it reproduces something!):

use std;
import std::option;
import std::option::none;

tag sty {
    ty_nil;
}

type raw_t = rec(sty struct,
                 option::t[str] cname,
                 uint hash);

fn mk_raw_ty(sty st, &option::t[str] cname) -> raw_t {
  ret rec(struct=st,
          cname=cname,
          hash=0u);
}

fn main() {
  mk_raw_ty(ty_nil, none[str]);
}

On the test case valgrind reports:

==15590== Conditional jump or move depends on uninitialised value(s)
==15590==    at 0x80496C3: _rust_fn1_mk_raw_ty (in /home/brian/Dev/rust/build/test/run-pass/compare.stage1)
==15590==    by 0x8049743: _rust_fn2_main (in /home/brian/Dev/rust/build/test/run-pass/compare.stage1)
==15590==    by 0x804945E: rust_exit_task_glue (in /home/brian/Dev/rust/build/test/run-pass/compare.stage1)

It seems to be related to the alias parameter, but changing just about anything in the test case makes the bug go into hiding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions