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

Error: internal error: openArrayLoc: ref array[0..0, int] with new array[1, int] and toOpenArray #23321

Closed
tersec opened this issue Feb 18, 2024 · 1 comment · Fixed by #23548
Assignees
Labels

Comments

@tersec
Copy link
Contributor

tersec commented Feb 18, 2024

Description

var d = new array[1, int]
discard d[].toOpenArray(0, 0)

Nim Version

Nim Compiler Version 1.6.19 [Linux: amd64]
Compiled at 2024-02-18
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: d08bba579da7df36c51d987c04085628d81cb92f
active boot switches: -d:release
Nim Compiler Version 2.0.3 [Linux: amd64]
Compiled at 2024-02-18
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 3be251468365250a1ad2e86bb2fa634ff7297b61
active boot switches: -d:release
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-02-18
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 92c8c6d5f4e5a96b71bf4eca5f6a136410f97d6e
active boot switches: -d:release

Current Output

Error: internal error: openArrayLoc: ref array[0..0, int]
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details

Expected Output

No ICE

Possible Solution

No response

Additional Information

No response

@litlighilit
Copy link
Contributor

workaround:

var d = new array[1, int]
var a = d[]
discard a.toOpenArray(0, 0)

@ringabout ringabout self-assigned this Apr 29, 2024
Araq pushed a commit that referenced this issue Apr 29, 2024
…t] (#23548)

fixes #23321

In the function `mapType`, ptrs (tyPtr, tyVar, tyLent, tyRef)
are mapped into ctPtrToArray, the dereference of which is skipped
in the `genref`. We need to skip these ptrs in the function
`genOpenArraySlice`.
narimiran pushed a commit that referenced this issue May 22, 2024
…t] (#23548)

fixes #23321

In the function `mapType`, ptrs (tyPtr, tyVar, tyLent, tyRef)
are mapped into ctPtrToArray, the dereference of which is skipped
in the `genref`. We need to skip these ptrs in the function
`genOpenArraySlice`.

(cherry picked from commit d09c3c0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants