diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-09-24 15:59:30 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-09-24 15:59:30 +0200 |
commit | 683e1e8faf206f0fdb9738278a00e9920fb488c5 (patch) | |
tree | 34b976d16322a8418a030a577d1515435a7843e0 | |
parent | d92f2526092d9ca088f83168c9bf4459ed0b9e35 (diff) | |
parent | a8e547971fe4e638f8f8392005d9cc5f0a4a2f1d (diff) | |
download | Nim-683e1e8faf206f0fdb9738278a00e9920fb488c5.tar.gz |
Merge pull request #3368 from kirbyfan64/set_crash_fix
Fix #3367
-rw-r--r-- | compiler/types.nim | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/types.nim b/compiler/types.nim index 5f3a74aca..66fb657fc 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -1265,13 +1265,16 @@ proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt = else: result = 8 a = result of tySet: - length = lengthOrd(typ.sons[0]) - if length <= 8: result = 1 - elif length <= 16: result = 2 - elif length <= 32: result = 4 - elif length <= 64: result = 8 - elif align(length, 8) mod 8 == 0: result = align(length, 8) div 8 - else: result = align(length, 8) div 8 + 1 + if typ.sons[0].kind == tyGenericParam: + result = szUnknownSize + else: + length = lengthOrd(typ.sons[0]) + if length <= 8: result = 1 + elif length <= 16: result = 2 + elif length <= 32: result = 4 + elif length <= 64: result = 8 + elif align(length, 8) mod 8 == 0: result = align(length, 8) div 8 + else: result = align(length, 8) div 8 + 1 a = result of tyRange: result = computeSizeAux(typ.sons[0], a) |