Change:
Minimal reproducible example, targeting the STM32G030F6 microcontroller: This panics in the computation of when built with: Note: this had to be tested with in the dev profile, in order to fit on the small flash size on the chip. This was confirmed on the and toolchains. <details<summaryGDB backtrace at the panic</summary</details<details<summaryFull to build</summary</details<details<summarymemory.x for the STM32G030F6</summary</details
Would it be possible to provide the output for this test case?
This is inside compiler-builtins. The arguments in the stack trace seem all sorts of wrong all over the place, though. But the shift width passed into is what you'd expect. An ABI mismatch, maybe?
To elaborate on my remark above: the LLVM IR will only reveal a plain instruction, which becomes a libcall only in codegen. To the issue author: can you please also post the exact command you're building? I'm not able to reproduce a similar issue when using a based approach – in particular I see many more functions being inlined away, functions which in your case don't appear to be. This is what I was trying:
Cortex-M0+ uses , which is also shipped via rustup
Hm, I cannot reproduce inside QEMU (using , steps described below), but maybe I'm missing something (maybe the error only shows up on the real hardware and not in QEMU). Please correct me, if I'm wrong. <details<summaryReproduction</summary</details
Sorry, I will put together a package that fully demonstrates it and upload a tarball later today. I'll also provide the LLVM and executable output. To be clear, I wasn't building using any direct invocation of rustc, just with cargo.
So I managed to simplify the minimal example further a bit, as it turns out that simply panics too, since the formatter for integers involves multiplication. This is reflected in the following attachments. I have tested these on a live STM32G030 chip; the GDB backtrace is from that (over openocd through the SWD port). I don't consider myself knowledgable enough with QEMU to try to reproduce it there. Complete example: Executable: <details<summaryGDB backtrace at panic</summary</details<details<summaryLLVM IR</summary</details
does it also reproduce on Rust stable (or beta)? Just to understand here if it's a regression or this issue has "always" been here (I suspect the latter)
Assigning priority as discussed in the of the Prioritization Working Group. label -I-prioritize +P-medium
Good thinking... I just tested it on stable and it appears to not be present there (or at least not with all else equal). I confirmed the issue on again just to be sure I didn't change anything else. I'm not sure if there's a good way to bisect the rust toolchain to find the regression? If there is I may be able to script it to see if GDB reports a panic and use that. Of course QEMU would be better-suited for that, so I may try to repro in it as well.
cool then probably we can try to find the regression To bisect we use , it will download nightlies in a range of time and bisect them to find where the regression starts. You'll need to download the Rust sources beforehand (this repo) and then run it like: should be 755 and something like: cargo-bisect will then download nightlies. The first one must not reproduce the issue, so if it does, move a bit back in time until you hit one of the last good nightly. If everything goes well you should get an ouput similar to Thanks a lot for trying to bisect the issue! :-) label regression-from-stable-to-nightly
Here's the report: searched nightlies: from nightly-2021-04-01 to nightly-2021-06-05 regressed nightly: nightly-2021-05-15 searched commits: from to regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.0</summaryHost triple: x86_64-unknown-linux-gnu Reproduce with:
That is a huge commit, but if it helps, I have a hunch that the regression may actually be in , since a) the version of it changed as part of that commit and b) that's where the implementaiton of this is. On the other hand, the connection to is weird. Before reporting the issue I did delve into the source but most of the arithmetic implementation stuff kinda went over my head unfortunately.
This is highly likely to slip into stable next week -- let's ping arm to at least get some more eyes on it (doesn't look like that was done yet).
Error: Parsing ping command in failed: ...'t ping arm' ' to at lea'... Please let know if you're having trouble with this bot.
ping arm
Hey ARM Group! This bug has been identified as a good "ARM candidate". In case it's useful, here are some [instructions] for tackling these sorts of bugs. Maybe take a look? Thanks! <3 [instructions]: https://rustc-dev- cc
I can reproduce this on qemu. I'm not sure precisely what I'm doing differently to but I'm using the source tarball uploaded (plus a modified memory layout for the QEMU machine). Possibly in the cargo config would do it. From the last working rust commit bumping compiler-builtins to 0.1.40 (from 0.1.39) is enough to trigger this. Unfortunately, patching out compilerbuiltins to a local path (checked out to 0.1.39) also seems to reliably trigger it so I haven't been able to narrow down to a specific compilerbuiltins commit. Additionally I can't reproduce on , only v6.
That matches what I observed on real hardware as well.
54 stable will be built today and released on Thursday, this will unfortunately have to slip into stable :( The target is not tier 1 so this won't block the release, but it will be in the compatibility notes section.
Is the build process documented somewhere? Is it a highly optimized binary?
The build itself is done by our normal CI and the full release process is . The build doesn't take that long to finish though. The Release Team prepares the final release on Monday to be able to publish a pre-release on Monday evening, allowing testing from the wider community before the actual release goes out. It's possible to do a rebuild after Monday if critical issues are found and need to be fixed, but is not a Tier 1 target so a fix for this would likely not result in a rebuild, and would slip into 1.55.
Thanks! I noted that the python scripts use the aws cli instead of the excellent boto3 library. But probably the scripts are battle proof by now.
This is a bug in LLVM's expansion of 128-bit shifts: The 128-bit shift is expanded to a series of 64-bit shift via . Note how the shift value in is only masked with before being passed to . This means that the shift value passed to may be larger than 64, which is UB according to the specification for (shift value must be < 64).
A bisect on compiler-builtins leads to this commit as the incidental "cause": Reverting it does fix this bug if a quick & dirty fix is wanted.
On second thought, I don't think this is an LLVM bug: it seems that the code calls with an out-of-range shift, but then doesn't actually use the result of that call in that case. I opened which should fix this, could someone test to see if this actually resolves the issue?
looks fixed to me. Nice work!

Discussion:
[[package]] name = "compiler_builtins" <del> version = "0.1.47" </del> <ins> version = "0.1.49" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "fd4ed89e0a5c3e50b15c0045fbe1ff8567b703bc07544faf935ddff0aaa7b65f" </del> <ins> checksum = "20b1438ef42c655665a8ab2c1c6d605a305f031d38d9be689ddfef41a20f3aa2" </ins> dependencies = [ "cc", "rustc-std-workspace-core",