summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-03-12 11:40:14 +0100
committerAraq <rumpf_a@web.de>2015-03-12 11:40:14 +0100
commit0a0126d49aecc7915ae115f267f99d9510c70bdb (patch)
tree037007d87b783f7e7174a874c810fc9ecac91058
parent3aad16e337a18861d76df24f8137d2dbe1144ac2 (diff)
downloadNim-0a0126d49aecc7915ae115f267f99d9510c70bdb.tar.gz
fixes #794 properly
-rw-r--r--compiler/transf.nim4
-rw-r--r--tests/ccgbugs/tstringslice.nim15
2 files changed, 14 insertions, 5 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim
index 7e56f09dc..325ce9d5e 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 d4d1a2294..00c1adf74 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]
 
all_ingredient?h=main&id=576990113273caed9a045380f1457adc1df6a5ee'>57699011 ^
69f04c3f ^
88be3dbc ^
1ead3562 ^
4be9a93b ^

1ead3562 ^
5497090a ^
4be9a93b ^


ca01193d ^
fca0ebbe ^
016599f1 ^
b24eb476 ^
50eab110 ^

69f04c3f ^
3eeea0a2 ^
b24eb476 ^
67573caf ^
3473c63a ^
c9a5a7ba ^
016599f1 ^
1fa53058 ^
69f04c3f ^
1848b18f ^

69f04c3f ^
795f5244 ^
166e3c0d ^
69f04c3f ^
166e3c0d ^
acc4792d ^
e4630643 ^

166e3c0d ^



31401373 ^
67573caf ^
3473c63a ^
c9a5a7ba ^
3a982057 ^



1b76245c ^
3a982057 ^
81c87f08 ^

1b76245c ^
691b529e ^
1fa53058 ^
0487a30e ^
67573caf ^
ac0e9db5 ^
0487a30e ^
67573caf ^
69f04c3f ^
4be9a93b ^
3e849f11 ^
1b76245c ^
75aa3a98 ^
0487a30e ^
75aa3a98 ^
b24eb476 ^

75aa3a98 ^
0487a30e ^
4be9a93b ^
69f04c3f ^

717ab659 ^
5f98a10c ^

1ead3562 ^
3e849f11 ^

1ead3562 ^
3e849f11 ^

5f98a10c ^
3e849f11 ^
88be3dbc ^
1ead3562 ^
bc643692 ^
717ab659 ^
1ead3562 ^
5497090a ^
717ab659 ^

5497090a ^
717ab659 ^








795f5244 ^
166e3c0d ^



717ab659 ^

67573caf ^
717ab659 ^


88be3dbc ^
1ead3562 ^
bc643692 ^
717ab659 ^
1ead3562 ^
bc643692 ^
5497090a ^
717ab659 ^






795f5244 ^
166e3c0d ^
717ab659 ^
166e3c0d ^
acc4792d ^
e4630643 ^

5f98a10c ^
1b76245c ^
e4630643 ^

166e3c0d ^



b24eb476 ^
67573caf ^
0487a30e ^
67573caf ^
ac0e9db5 ^
827898fc ^
67573caf ^
717ab659 ^

ac0e9db5 ^
0487a30e ^

827898fc ^
717ab659 ^



c9a5a7ba ^






b0bf5321 ^
c9a5a7ba ^
b0bf5321 ^

c9a5a7ba ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183