tvolatile.nim 265 B

12345678910111213141516
  1. import std/[volatile, assertions]
  2. var st: int
  3. var foo: ptr int = addr st
  4. volatileStore(foo, 12)
  5. doAssert volatileLoad(foo) == 12
  6. # bug #14623
  7. proc bar =
  8. var st: int
  9. var foo: ptr int = addr st
  10. volatileStore(foo, 12)
  11. doAssert volatileLoad(foo) == 12
  12. bar()