Skip to content

Commit a9051d2

Browse files
ilinumJukkaL
andauthoredFeb 15, 2023
[backport] [mypyc] Fix test case testI64Cast on 32-bit architectures (#14700)
Backport of #14691. Co-authored-by: Jukka Lehtosalo <jukka.lehtosalo@iki.fi>
1 parent 83db085 commit a9051d2

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed
 

‎mypyc/test-data/irbuild-i64.test

+34-1
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ def f5():
17311731
L0:
17321732
return 4
17331733

1734-
[case testI64Cast]
1734+
[case testI64Cast_64bit]
17351735
from typing import cast
17361736
from mypy_extensions import i64
17371737

@@ -1772,6 +1772,39 @@ L2:
17721772
L3:
17731773
return r3
17741774

1775+
[case testI64Cast_32bit]
1776+
from typing import cast
1777+
from mypy_extensions import i64
1778+
1779+
def cast_int(x: int) -> i64:
1780+
return cast(i64, x)
1781+
[out]
1782+
def cast_int(x):
1783+
x :: int
1784+
r0 :: native_int
1785+
r1 :: bit
1786+
r2, r3, r4 :: int64
1787+
r5 :: ptr
1788+
r6 :: c_ptr
1789+
r7 :: int64
1790+
L0:
1791+
r0 = x & 1
1792+
r1 = r0 == 0
1793+
if r1 goto L1 else goto L2 :: bool
1794+
L1:
1795+
r2 = extend signed x: builtins.int to int64
1796+
r3 = r2 >> 1
1797+
r4 = r3
1798+
goto L3
1799+
L2:
1800+
r5 = x ^ 1
1801+
r6 = r5
1802+
r7 = CPyLong_AsInt64(r6)
1803+
r4 = r7
1804+
keep_alive x
1805+
L3:
1806+
return r4
1807+
17751808
[case testI64ExplicitConversionFromVariousTypes]
17761809
from mypy_extensions import i64
17771810

0 commit comments

Comments
 (0)
Please sign in to comment.