From 0a0126d49aecc7915ae115f267f99d9510c70bdb Mon Sep 17 00:00:00 2001 From: Araq Date: Thu, 12 Mar 2015 11:40:14 +0100 Subject: [PATCH] fixes #794 properly --- compiler/transf.nim | 4 ++-- tests/ccgbugs/tstringslice.nim | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/transf.nim b/compiler/transf.nim index 7e56f09dc1..325ce9d5eb 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -399,7 +399,7 @@ proc transformConv(c: PTransf, n: PNode): PTransNode = if diff < 0: result = newTransNode(nkObjUpConv, n, 1) result[0] = transform(c, n.sons[1]) - elif diff > 0: + elif diff > 0 and diff != high(int): result = newTransNode(nkObjDownConv, n, 1) result[0] = transform(c, n.sons[1]) else: @@ -411,7 +411,7 @@ proc transformConv(c: PTransf, n: PNode): PTransNode = if diff < 0: result = newTransNode(nkObjUpConv, n, 1) result[0] = transform(c, n.sons[1]) - elif diff > 0: + elif diff > 0 and diff != high(int): result = newTransNode(nkObjDownConv, n, 1) result[0] = transform(c, n.sons[1]) else: diff --git a/tests/ccgbugs/tstringslice.nim b/tests/ccgbugs/tstringslice.nim index d4d1a22948..00c1adf74b 100644 --- a/tests/ccgbugs/tstringslice.nim +++ b/tests/ccgbugs/tstringslice.nim @@ -1,9 +1,18 @@ discard """ - disabled: "true" + output: '''1 +1234 +1234 +2 +234 +234 +3 +34 +34 +4 +4 +4''' """ -# Now the compiler fails with OOM. yay. - # bug #794 type TRange = range[0..3]