summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system/repr.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/system/repr.nim b/lib/system/repr.nim
index 51498b3f5..2dec8136c 100755
--- a/lib/system/repr.nim
+++ b/lib/system/repr.nim
@@ -50,6 +50,8 @@ proc reprChar(x: char): string {.compilerRtl.} =
   add result, "\'"
 
 proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} =
+  # we read an 'int' but this may have been too large, so mask the other bits:
+  let e = e and (1 shl (typ.size*8)-1)
   if ntfEnumHole notin typ.flags:
     if e <% typ.node.len:
       return $typ.node.sons[e].name