-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seq pop malfunctions in array of seqs #24596
Comments
!nim c --gc:arc -d:lto proc main() =
var trimMap = [@[1], @[2]]
var z = 0
for j in 0 ..< 2:
var i = trimMap.high
while i >= 0:
#let len {.volatile} = trimMap[i].len # this way it "works"
let len = trimMap[i].len
if len > 0:
z = trimMap[i].pop()
echo "set"
break
dec i
echo "popped ", i
doAssert z != 0
echo "z", z
main() |
🐧 Linux bisect by @juancarlospaco (collaborator)devel 👍 OKOutput
Filesize stable 👍 OKOutput
Filesize 2.0.10 👍 OKOutput
Filesize 2.0.0 👍 OKOutput
Filesize 1.6.20 👍 OKOutput
Filesize 1.4.8 👎 FAILOutput
Filesize 1.2.18 👍 OKOutput
Filesize 1.0.10 👎 FAILOutput
Filesize #a4f9bc55c ➡️ 🐛Diagnosticscooldome introduced a bug at
The bug is in the files:
The bug can be in the commits:
(Diagnostics sometimes off-by-one). Stats
🤖 Bug found in |
Description
Following code
prints:
on both devel and 2.0.14, when compiled like:
with clang version 18.1.8. (-d:release instead of -d:danger has the same effect.)
The crash disappears if I do any of:
It also disappears if I switch to GCC, but this is probably by accident.
The original program that I reduced this from crashes under GCC as well.
len is supposed to be set in shrink:
Perhaps the cast violates strict aliasing?
Nim Version
Current Output
No response
Expected Output
Known Workarounds
No response
Additional Information
ETA: this seems to fix it
C allows aliasing with the first member, so it makes sense.
But if it's a strict aliasing problem, then it's not an adequate fix, because the cast is also performed in other functions.
The text was updated successfully, but these errors were encountered: