-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvm lint: "Undefined behavior: Call argument type mismatches callee parameter type" with mixing debug and release #48310
Comments
Another example from rusts own codebase trait Foo {
extern fn borrow(&self);
extern fn take(self: Box<Self>);
}
struct Bar;
impl Foo for Bar {
extern fn borrow(&self) {}
extern fn take(self: Box<Self>) {}
}
fn main() {
let foo: Box<dyn Foo> = Box::new(Bar);
foo.borrow();
foo.take()
} src/test/run-pass/issues/issue-51907.rs ( when compiled with
|
Nominating to figure out how bad this is. Might be related to #55976. |
I believe LLVM's linting is in the wrong here. The purported type mismatch is that the caller passes [1] slight caveat -- currently it still matters for |
triage: P-high for two tasks: 1. resolve whether this is indeed an LLVM bug, and if so, 2. filing a bug against LLVM. removing nomination since I don't think there's much to discuss beyond 1. what's already in @rkruppe's comment and 2. assigning the issue (like any other P-high T-compiler issue) to someone on the compiler team to address. |
I can still reproduce with |
@matthiaskrgr hmm, interesting. Are you reproducing via the reduced version from this comment above (which is what I am doing)? Or some other reproduction? |
(I was going to assume that this was fixed by #51966, but @matthiaskrgr is making me pause. I'll see what I can figure out.) |
I was trying the very first example in the original ticket description
|
Ah I just realized that I was not correctly reproducing the original bug; there is a different ICE, from librustc_codegen_llvm/abi.rs, that is resolved in the range I mentioned. |
Okay, I'm going to try to course-correct my signal-to-noise ratio for my comments on this issue. Since the bug seems to only occur with So I used The answer:
(So: its possible that there is a bug in the LLVM lint. Or it is possible that the LLVM lint is exposing a bug in the LLVM early-cse pass.) |
I'm in the process of registering an account on bugs.llvm.org. While I wait for that to happen, I'll jot my last note here, which I think provides sufficient information to illustrate the problem to LLVM developers:
Click to see contents of `narrowed-48310.rs` that I used// compile-flags: -Copt-level=3 -Cpasses=lint
trait Foo {
extern fn borrow(&self);
}
struct Bar;
impl Foo for Bar {
extern fn borrow(&self) {}
}
fn main() {
let foo: Box<dyn Foo> = Box::new(Bar);
foo.borrow();
} This generated
So now I have two files, which present the input to and output from LLVM's ((I also had a go at trying to use bugpoint to reduce the |
Okay, filed an LLVM bug here: https://bugs.llvm.org/show_bug.cgi?id=42380 At this point, given that this bug only has an impact on LLVM's internal lint pass (which we do not have turned on by default), and does not (as far as we know) represent an observable problem in code-generation, I am going to close this as an LLVM bug that is not our job to fix. |
This was reduced from https://github.com/ogham/rust-ansi-term (lib crate) @ 090e0a383d73a43e2f80a7b466e8feeee97c4c76
add this to cargo.toml
and this as your lib.rs:
build with
EDIT: meta:
// cc #7463
The text was updated successfully, but these errors were encountered: