Skip to content
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

Accessing an empty array sometimes works #18643

Closed
iacore opened this issue Aug 4, 2021 · 0 comments
Closed

Accessing an empty array sometimes works #18643

iacore opened this issue Aug 4, 2021 · 0 comments
Labels
Invalid Code Acceptance Everything related to compiler not complaining about invalid code Semantic Analysis Showstopper

Comments

@iacore
Copy link
Contributor

iacore commented Aug 4, 2021

Example

echo "Hello world"
let a: array[0, int] = []
let b = 9999999
echo a[b]

Current Output

Hello world
0

Expected Output

Hello world
/usr/lib/nim/system/fatal.nim(49) sysFatal
Error: unhandled exception: index 9999999 not in 0 .. -1 [IndexDefect] (something like this)
~> nim -v
Nim Compiler Version 1.4.8 [Linux: amd64]
Compiled at 2021-06-07
Copyright (c) 2006-2021 by Andreas Rumpf

active boot switches: -d:release -d:nativeStackTrace
@ringabout ringabout added Invalid Code Acceptance Everything related to compiler not complaining about invalid code Semantic Analysis labels Aug 6, 2021
Araq added a commit that referenced this issue Aug 12, 2021
@Araq Araq closed this as completed in 018465a Aug 12, 2021
narimiran pushed a commit that referenced this issue Aug 24, 2021
(cherry picked from commit 018465a)
narimiran pushed a commit that referenced this issue Aug 24, 2021
(cherry picked from commit 018465a)
narimiran pushed a commit that referenced this issue Aug 24, 2021
(cherry picked from commit 018465a)
PMunch pushed a commit to PMunch/Nim that referenced this issue Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Code Acceptance Everything related to compiler not complaining about invalid code Semantic Analysis Showstopper
Projects
None yet
Development

No branches or pull requests

3 participants