Skip to content

Broken LLVM function when pushing dyn* item to Vec. #102141

Closed

Description

@mejrs

Playground

Code

#![feature(dyn_star)]
#![allow(incomplete_features)]

use core::fmt::Debug;

fn main() {
    let mut v = vec![];
    let i = 42_u8 as dyn* Debug;
    v.push(i);
}

Result:

Call parameter type does not match function signature!
i8 42
 i64  invoke void @"_ZN5alloc3vec16Vec$LT$T$C$A$GT$4push17h57979dab0e1643c2E"(ptr align 8 %3, i8 42, ptr align 8 @6)
          to label %14 unwind label %8, !dbg !2675
in function _ZN10playground4main17h68903ee09fbec9bcE
LLVM ERROR: Broken function found, compilation aborted!

Meta

1.66.0-nightly (2022-09-21 9062b780b32d2eab060b)

@rustbot label: +F-dyn_star +requires-nightly +A-LLVM

Activity

  1. added
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    F-dyn_star`#![feature(dyn_star)]`
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Sep 22, 2022
  2. matthiaskrgr commented on Sep 22, 2022

    @matthiaskrgr
    Member

    Miri actually reports this as a bug :)

    error: Undefined Behavior: scalar size mismatch: expected 8 bytes but got 1 bytes instead
     --> src/main.rs:8:13
      |
    8 |     let i = 42_u8 as dyn* Debug;
      |             ^^^^^^^^^^^^^^^^^^^ scalar size mismatch: expected 8 bytes but got 1 bytes instead
      |
      = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
      = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
      = note: BACKTRACE:
      = note: inside `main` at src/main.rs:8:13
    
  3. compiler-errors commented on Sep 22, 2022

    @compiler-errors
    Contributor

    FYI: We currently have 0 checks that dyn* actually fit their size requirement currently.

  4. added a commit that references this issue on Nov 16, 2022
    9cd06e6
  5. added 3 commits that reference this issue on Nov 18, 2022
    6520fdc
    171b519
    24ee599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.F-dyn_star`#![feature(dyn_star)]`requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions