Skip to content

Crash in shape code during tag comparison #1535

@brson

Description

@brson

The second comparison crashes. Probably due to weird alignment.

tag modlist = [int];                                                                                                                                                          

fn main() {                                                                                                                                                                   
    let ml = modlist([]);                                                                                                                                                     
    assert ml == modlist([]);                                                                                                                                                 
    assert ml == modlist([]);                                                                                                                                                 
}   
==27842== Thread 2:
==27842== Invalid read of size 8
==27842==    at 0x50FA892: shape::ctxt<shape::data<shape::cmp, shape::ptr_pair> >::walk_vec0() (rust_shape.h:964)
==27842==    by 0x50FA084: shape::ctxt<shape::data<shape::cmp, shape::ptr_pair> >::walk() (rust_shape.h:372)
==27842==    by 0x50F6879: shape::cmp::walk_variant2(shape::tag_info&, unsigned long, std::pair<unsigned char const*, unsigned char const*>) (rust_shape.cpp:423)
==27842==    by 0x50F6914: shape::cmp::walk_tag2(shape::tag_info&, shape::data_pair<unsigned long> const&) (rust_shape.h:955)
==27842==    by 0x50F98E5: shape::data<shape::cmp, shape::ptr_pair>::walk_tag1(shape::tag_info&) (rust_shape.h:993)
==27842==    by 0x50F9A8C: shape::ctxt<shape::data<shape::cmp, shape::ptr_pair> >::walk_tag0() (rust_shape.h:468)
==27842==    by 0x50F9F6C: shape::ctxt<shape::data<shape::cmp, shape::ptr_pair> >::walk() (rust_shape.h:373)
==27842==    by 0x50F6732: shape_cmp_type (rust_shape.cpp:542)
==27842==    by 0x5101E48: ??? (in /home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so)
==27842==    by 0x64A06AF: ???
==27842==    by 0x64A5FEF: ???
==27842==    by 0x533482F: ??? (in /home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so)
==27842==  Address 0x100000000064ac1 is not stack'd, malloc'd or (recently) free'd

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions