Stream: t-compiler/wg-prioritization/alerts

Topic: I-prioritize #80309 Miscompilation when using wrapping_sub/…


triagebot (Dec 22 2020 at 21:53, on Zulip):

@WG-prioritization/alerts issue #80309 has been requested for prioritization.

Procedure

Léo Lanteri Thauvin (Dec 22 2020 at 22:02, on Zulip):

Is this unsound? I'm always confused

Léo Lanteri Thauvin (Dec 22 2020 at 22:06, on Zulip):

I wonder if this is a regression

Léo Lanteri Thauvin (Dec 22 2020 at 22:22, on Zulip):

No, this seems to happen since 1.16.0 when ptr_wrapping_offset was stabilized

Stu (Dec 22 2020 at 22:25, on Zulip):

P-critical I guess? Illegal instruction using only safe code seems bad

Léo Lanteri Thauvin (Dec 22 2020 at 22:26, on Zulip):

Right, but I think it must be hard to hit in real code

Stu (Dec 22 2020 at 22:27, on Zulip):

Yea that’s true

Léo Lanteri Thauvin (Dec 22 2020 at 22:27, on Zulip):

I was wondering if I could try to look at the LLVM IR

Léo Lanteri Thauvin (Dec 22 2020 at 22:28, on Zulip):

Turns out this simple program generates 2182 lines (!) of LLVM IR with --emit=llvm-ir :eyes:

Léo Lanteri Thauvin (Dec 22 2020 at 22:28, on Zulip):

I wasn't prepared :D

Joshua Nelson (Dec 22 2020 at 22:30, on Zulip):

@Léo Lanteri Thauvin it should be a lot smaller if you remove the println

Joshua Nelson (Dec 22 2020 at 22:31, on Zulip):

and compile with panic=abort

Léo Lanteri Thauvin (Dec 22 2020 at 22:31, on Zulip):

Ah, yes, that explains things :)

Léo Lanteri Thauvin (Dec 22 2020 at 22:32, on Zulip):

Also I need to use -O :face_palm:

Joshua Nelson (Dec 22 2020 at 22:32, on Zulip):

well if you use -O then you see it after the miscompilation

Joshua Nelson (Dec 22 2020 at 22:32, on Zulip):

which may or may not be what you want

Léo Lanteri Thauvin (Dec 22 2020 at 22:33, on Zulip):

The miscompilation probably happens in LLVM, right?

Joshua Nelson (Dec 22 2020 at 22:33, on Zulip):

I would be shocked if it happened in mir-opts

Léo Lanteri Thauvin (Dec 22 2020 at 22:33, on Zulip):

I know pretty much nothing about codegen :tired:

Joshua Nelson (Dec 22 2020 at 22:33, on Zulip):

especially since it's release-only

Léo Lanteri Thauvin (Dec 22 2020 at 22:34, on Zulip):

Does --emit=llvm-ir emit the IR before or after the LLVM passes?

tm (Dec 22 2020 at 22:35, on Zulip):

after; you can disable LLVM passes with -Cno-prepopulate-passes

Léo Lanteri Thauvin (Dec 22 2020 at 22:35, on Zulip):

Ah, alright thanks :)

tm (Dec 22 2020 at 22:37, on Zulip):

-Copt-level=1 still works (for me), so it might be better starting point for bisection

Léo Lanteri Thauvin (Dec 22 2020 at 22:38, on Zulip):

https://github.com/rust-lang/rust/issues/80309#issuecomment-749813415 :smile:

apiraino (Dec 23 2020 at 10:45, on Zulip):

thinking about the priority, would it make sense a P-high (although there is a repro also on safe code). I can't figure out the impact on real code (and if warrants a P-critical)

lcnr (Dec 23 2020 at 13:17, on Zulip):

I think starting with P-critical makes the most sense

Stu (Dec 23 2020 at 13:22, on Zulip):

Yea I agree. Even if it’s super hard to hit it in real code it shouldn’t be possible

apiraino (Dec 23 2020 at 13:22, on Zulip):

because of the safe code reproducible?

Stu (Dec 23 2020 at 13:24, on Zulip):

Yes

Last update: Apr 15 2021 at 03:00UTC