You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the voilatile module currently incurs in a compiler error.
I have run a git bisect and the outcome is the following:
*[72d0ba2df][~/projects/nim/Nim]$ git bisect good
9b378296f65fff962225acc1bef2b3811fffda03 is the first bad commit
commit 9b378296f65fff962225acc1bef2b3811fffda03
Author: ringabout <43030857+ringabout@users.noreply.github.com>
Date: Wed Apr 10 20:41:16 2024 +0800
fixes addr/hiddenAddr in strictdefs (#23477)
I know this is not a perfect use case for it, but for example I use import volatile to interact with memory mapped registers on mcus, and it's a necessary feature there.
Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-12
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 779bc84
active boot switches: -d:release
Current Output
Hint: used config file '/home/mar/projects/nim/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/mar/projects/nim/Nim/config/config.nims' [Conf]
......................................................................
/home/mar/projects/nim/volatile_test/vol.nim(6, 16) template/generic instantiation of `volatileStore` from here
/home/mar/projects/nim/Nim/lib/pure/volatile.nim(31, 12) Error: type mismatch
Expression: `[]=`(ctr, 1)
[1] ctr: int
[2] 1: int literal(1)
Expected one of (first mismatch at [position]):
[0] proc `[]=`(s: var string; i: BackwardsIndex; x: char)
[0] proc `[]=`[I: Ordinal; T, S](a: T; i: I; x: sink S)
[0] proc `[]=`[Idx, T; U, V: Ordinal](a: var array[Idx, T]; x: HSlice[U, V];
b: openArray[T])
[0] proc `[]=`[Idx, T](a: var array[Idx, T]; i: BackwardsIndex; x: T)
[0] proc `[]=`[T, U: Ordinal](s: var string; x: HSlice[T, U]; b: string)
[0] proc `[]=`[T; U, V: Ordinal](s: var seq[T]; x: HSlice[U, V]; b: openArray[T])
[0] proc `[]=`[T](s: var openArray[T]; i: BackwardsIndex; x: T)
[0] template `[]=`(a: WideCStringObj; idx: int; val: Utf16Char)
[0] template `[]=`(s: string; i: int; val: char)
procsemArrPut(c: PContext; n: PNode; flags: TExprFlags): PNode=# rewrite `[]=`(a, i, x) back to ``a[i] = x``.let b =newNodeI(nkBracketExpr, n.info)
b.add(n[1].skipAddr)
I don't think it should skip addr here or it should handle addr deref here and it wasn't skipped before because addr ... existed in the form of a magic function.
fixes#23499
In the
8990626
the effect of `skipAddr` changed to skip `nkAddr` and `nkHiddenAddr`.
Some old code was not adapted. In the
#23477, the magic `addr` function
was handled in the semantic analysis phase, which causes it be skipped
incorrectly
Description
Using the voilatile module currently incurs in a compiler error.
I have run a
git bisect
and the outcome is the following:Minimal example:
I know this is not a perfect use case for it, but for example I use
import volatile
to interact with memory mapped registers on mcus, and it's a necessary feature there.Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-12
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 779bc84
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: