From afbcd1b330f16294cee32efca1b2f9060874a497 Mon Sep 17 00:00:00 2001 From: Arne Döring Date: Wed, 7 Aug 2019 15:53:16 +0200 Subject: int128 on firstOrd, lastOrd and lengthOrd (#11701) * fixes #11847 --- compiler/sizealignoffsetimpl.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/sizealignoffsetimpl.nim') diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sizealignoffsetimpl.nim index 34384fa1f..6028ba5ee 100644 --- a/compiler/sizealignoffsetimpl.nim +++ b/compiler/sizealignoffsetimpl.nim @@ -332,7 +332,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) = typ.size = elemSize typ.align = int16(elemSize) else: - typ.size = lengthOrd(conf, typ.sons[0]) * elemSize + typ.size = toInt64(lengthOrd(conf, typ.sons[0]) * int32(elemSize)) typ.align = typ.sons[1].align of tyUncheckedArray: @@ -341,11 +341,11 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) = typ.size = 0 typ.align = base.align of tyEnum: - if firstOrd(conf, typ) < 0: + if firstOrd(conf, typ) < Zero: typ.size = 4 # use signed int32 typ.align = 4 else: - length = lastOrd(conf, typ) # BUGFIX: use lastOrd! + length = toInt64(lastOrd(conf, typ)) # BUGFIX: use lastOrd! if length + 1 < `shl`(1, 8): typ.size = 1 typ.align = 1 @@ -363,7 +363,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) = typ.size = szUncomputedSize typ.align = szUncomputedSize # in original version this was 1 else: - length = lengthOrd(conf, typ.sons[0]) + length = toInt64(lengthOrd(conf, typ.sons[0])) if length <= 8: typ.size = 1 elif length <= 16: -- cgit 1.4.1-2-gfad0