Incorrect Value when assigning list slices using OptimizationLevel::None #315
Labels
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#315
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reproduction
Python/NAC3 (
OptimizationLevel::Default
) Output:NAC3 (
OptimizationLevel::None
) Output:Changes which do not affect the bug
which will result in
bl2[1:2:2]
tobl2[1:2:<n>]
wheren > 1
Changes which stop the bug from manifesting
bl
instead of creating a new list and modifying itbl2[1:2:2]
tobl2[1:2:1]
bl2[1:2:2] = bl_1
Other Notes
Although this does not affect NAC3 under default settings, it still appears to be a bug worth fixing as this may be a bug in codegen.
Where exactly do you set -O?
nac3standalone/demo/src/codegen/mod.rs:236
:I was doing that to debug some IR codegen.
Okay. Why do you call that -O2/-O0?
Looks like probable broken IR indeed.
Because according to LLVM,
None
/Less
/Default
/Aggressive
corresponds to-O0
/-O1
/-O2
/-O3
respectively. No worries, I will refer to them by the enum names from now on.Incorrect Value when assigning list slices using -O0to Incorrect Value when assigning list slices using OptimizationLevel::NoneThis issue seemed to have gone away using the new pass manager. I guess more investigation is needed to determine whether this is a LLVM bug or NAC3 bug.
Most likely a NAC3 bug (invalid IR emitted). I suggest tracking it down using the old pass manager code.
Yes; seems like this might potentially be a stack lifetime issue that is just masked by more aggressive optimisations.
For debugging IR issues, using the standalone LLVM tools to run the optimiser/codegen pipeline (
opt
, or evenbugpoint
for automation) can be very helpful.So I found a much simpler way of reproducing the issue:
sb10q referenced this issue2023-09-15 16:48:02 +08:00
sb10q referenced this issue2023-09-15 16:48:03 +08:00
sb10q referenced this issue2023-09-15 16:48:03 +08:00