Closed
Description
code from tests/ui/foreign/foreign-truncated-arguments.rs
// run-pass
// compile-flags: -O
// Regression test for https://github.com/rust-lang/rust/issues/33868
#[repr(C)]
pub struct S {
a: u32,
b: f32,
c: u32
}
#[no_mangle]
#[inline(never)]
pub extern "C" fn test(s: S) -> u32 {
s.c
}
fn main() {
assert_eq!(test(S{a: 0, b: 0.0, c: 42}), 42);
}
When checked with rustc -Cpasses=lint src/test/ui/foreign/foreign-truncated-arguments.rs
, this generates the following llvm-ir lint warning:
Undefined behavior: Buffer overflow
%13 = load { i64, i32 }, { i64, i32 }* %12, align 4
repo @ 2342cc3
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generationCategory: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessHigh priorityStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Working group: LLVM backend code generation