summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semmagic.nim2
-rw-r--r--tests/misc/taddr.nim10
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim
index a8b0c9f18..8db62a9c8 100644
--- a/compiler/semmagic.nim
+++ b/compiler/semmagic.nim
@@ -73,7 +73,7 @@ proc semArrGet(c: PContext; n: PNode; flags: TExprFlags): PNode =
 proc semArrPut(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)
+  b.add(n[1].skipHiddenAddr)
   for i in 2..<n.len-1: b.add(n[i])
   result = newNodeI(nkAsgn, n.info, 2)
   result[0] = b
diff --git a/tests/misc/taddr.nim b/tests/misc/taddr.nim
index 48d4928ac..64f95c7e3 100644
--- a/tests/misc/taddr.nim
+++ b/tests/misc/taddr.nim
@@ -273,6 +273,16 @@ proc test15939() = # bug #15939 (v2)
   else: # can't take address of cstring element in js
     when not defined(js): cstringTest()
 
+block: # bug #23499
+  template volatileStore[T](dest: ptr T, val: T) =
+    dest[] = val
+
+  proc foo =
+    var ctr = 0
+    volatileStore(addr ctr, 0)
+
+  foo()
+
 template main =
   # xxx wrap all other tests here like that so they're also tested in VM
   test14420()
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129