Skip to content

LLVM errors in MIR trans for struct and tuple ConstVals. #30772

Closed
@solson

Description

@solson

These LLVM errors show up when compiling the following test cases with #[rustc_mir].

struct Point {
    _x: i32,
    _y: i32,
}

const STRUCT: Point = Point { _x: 42, _y: 42 };
let _struct = STRUCT;

// MIR: var0 = const expr Point{_x: 42, _y: 42,};

// Output:
// Stored value type does not match pointer operand type!
//   store { i32, i32 } { i32 42, i32 42 }, i64* %0, align 4
//  i64LLVM ERROR: Broken function found, compilation aborted!
const TUPLE: (i32, i32) = (42, 42);
let _tuple = TUPLE;

// MIR: var0 = const expr (42, 42);

// Output:
// Stored value type does not match pointer operand type!
//   store { i32, i32 } { i32 42, i32 42 }, i64* %0, align 4
//  i64LLVM ERROR: Broken function found, compilation aborted!
const TUPLE: (&'static str,) = ("ow",);
let _tuple = TUPLE;

// MIR: var0 = const expr ("ow",);

// Output:
// Invalid bitcast
// i8 addrspace(5)* bitcast ({ %str_slice } { %str_slice { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str2753, i32 0, i32 0), i64 2 } } to i8 addrspace(5)*)
// LLVM ERROR: Broken function found, compilation aborted!

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