| ... | @@ -1819,4 +1819,36 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -1819,4 +1819,36 @@ pub fn addCases(ctx: *TestContext) !void { |
| 1819 | ":2:28: error: cannot set address space of local variable 'foo'", | 1819 | ":2:28: error: cannot set address space of local variable 'foo'", |
| 1820 | }); | 1820 | }); |
| 1821 | } | 1821 | } |
| | 1822 | { |
| | 1823 | var case = ctx.exe("issue 10138: callee preserved regs working", linux_x64); |
| | 1824 | case.addCompareOutput( |
| | 1825 | \\pub fn main() void { |
| | 1826 | \\ const fd = open(); |
| | 1827 | \\ _ = write(fd, "a", 1); |
| | 1828 | \\ _ = close(fd); |
| | 1829 | \\} |
| | 1830 | \\ |
| | 1831 | \\fn open() usize { |
| | 1832 | \\ return 42; |
| | 1833 | \\} |
| | 1834 | \\ |
| | 1835 | \\fn write(fd: usize, a: [*]const u8, len: usize) usize { |
| | 1836 | \\ return syscall4(.WRITE, fd, @ptrToInt(a), len); |
| | 1837 | \\} |
| | 1838 | \\ |
| | 1839 | \\fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { |
| | 1840 | \\ _ = n; |
| | 1841 | \\ _ = a; |
| | 1842 | \\ _ = b; |
| | 1843 | \\ _ = c; |
| | 1844 | \\ return 23; |
| | 1845 | \\} |
| | 1846 | \\ |
| | 1847 | \\fn close(fd: usize) usize { |
| | 1848 | \\ if (fd != 42) |
| | 1849 | \\ unreachable; |
| | 1850 | \\ return 0; |
| | 1851 | \\} |
| | 1852 | , ""); |
| | 1853 | } |
| 1822 | } | 1854 | } |