if
ranching condition variable masked if else
leg empty (AVR ?)
#119572
Labels
C-bug
Category: This is a bug.
Hello,
The code is here.
Basically, it consists of:
I expected to see this happen:
Basically, at the start of the program,
CTR
is0
and thus theelse
branch is executed inside the loop.After some time, an interrupt is raised, and
CTR
is set to1
, and theif
branch should be run (and an LED turned on).Instead, this happened:
The LED never lights up. However, if I add an instruction in the
else
branch (like anop
), then the code runs as expected (the LED turns on afterwards)Meta
rustc --version --verbose
:For the sake of simplicity, I created two examples:
nop
in the else branch -> LED turns on.I tried to debug the compilation, and I see that:
MIR
The runtime optimized after MIR (006.000) looks okay on both cases:
GOOD:
MIR excerpt
BAD:
MIR excerpt
Basically, the diff is in
bb18
/bb19
LLVM-IR:
GOOD:
LLVM-IR excerpt
BAD:
LLVM-IR excerpt
I don't really know LLVM, but the
phi i8
that uses[0, %bb14]
looks strange to me, making the condition after always true ?Assembly
BAD:
To be honest I don't really understand instruction
24
; why would it try to load from0x0000
?What do you think ?
Many thanks for your help !
The text was updated successfully, but these errors were encountered: