Announcing Rust 1.99.1

30 points by BD103 23 hours ago on lobsters | 7 comments

[OP] BD103 | 23 hours ago

I’m not sure if bug fix releases are on topic, however I found the miscompilations and errors fixed to be pretty interesting!

I found and reported the bool FFI miscompilation. The behaviour I was observing was very confusing, and I'm generally extremely hesitant to blame the compiler. Eventually I brought the problem to the rest of the team and started with "I'm running into some strange behaviour, which is smelling like a compiler bug." somewhat reassuring that my suspicions did turn out to be correct in this case.

[OP] BD103 | 23 hours ago

Interesting! What behavior were you seeing that started your suspicion there was a compiler bug?

The initially observed issue was failing tests in our test suite. As I traced that through I eventually landed on a Rust function that returned a bool to Mercury code. Logging the value on the Rust side was fine, but then attempting to log the same value on the Mercury side was crashing the Mercury runtime. Eventually I logged the value from a C foreign_proc in Mercury and was seeing it was receiving the value 16 instead of 0 or 1. It was at this point that I suspected a compiler bug. Comparing the assembly of the function was also suspect:

1.99:

Disassembly of section .text.fontcode_rust_font_has_glyf:

0000000000000000 <fontcode_rust_font_has_glyf>:
       0: 0f b6 87 9f 01 00 00          movzbl  0x19f(%rdi), %eax
       7: c3                            retq


1.83:

Disassembly of section .text.fontcode_rust_font_has_glyf:

0000000000000000 <fontcode_rust_font_has_glyf>:
       0: 0f b6 87 9f 01 00 00          movzbl  0x19f(%rdi), %eax
       7: 24 01                         andb    $0x1, %al
       9: c3                            retq

From there I was able to build a small reproducer and open an issue on the rust repo.

pervognsen | 21 hours ago

When I saw it was about bools I thought for a second it was related to a miscompile I ran into a while ago on nightly, which originated in the MIR pass SimplifyComparisonIntegral: https://github.com/rust-lang/rust/issues/158231. By the time I confirmed the bug and updated the nightly toolchain to latest it'd already been fixed.

I ran into this a few weeks ago, so thank you very much for reporting it! In my case the type guards for my JIT compiler were incorrectly falling through because I was comparing the result of a runtime type guard that returned a bool, and it was returning bytes with other bits set despite ABI requirements :( https://github.com/chc4/lunacy/commit/1b94b976fd00869148fb0db3d639f65e9bda5a64

ralfj | 9 hours ago

Next time you see something like this, please file a bug so we can fix it faster. :)