<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Not extending i8 return values (r260133) broke Chromium on Darwin <= 10.9"
href="https://llvm.org/bugs/show_bug.cgi?id=26665">26665</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Not extending i8 return values (r260133) broke Chromium on Darwin <= 10.9
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hans@chromium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, nicolasweber@gmx.de, rjmccall@apple.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>r260133 changed LLVM to no longer extend i8/i16 return values to 32-bits, as
that is not required by the ABI and neither GCC or MSVC does it.
However, we found code in the wild relying on Clang's old behaviour,
specifically in the AppKit framework on Mac OS X <= 10.9 (we tested 10.8, 10.9,
10.10 and 10.14):
After LLVM r260133, the following Objective-C method in Chromium would no
longer extend its BOOL (signed char) return value:
browser_tests`-[NativeWidgetMacNSWindow canBecomeMainWindow]:
[...]
0x1017e3c68: movq %rbx, %rdi
0x1017e3c6b: callq 0x1018284c0 ;
views::NativeWidgetMac::GetBridgeForNativeWindow(NSWindow*)
0x1017e3c70: cmpq $0x0, 0x98(%rax)
0x1017e3c78: sete %al
0x1017e3c7b: jmp 0x1017e3c83 ; -[NativeWidgetMacNSWindow
canBecomeMainWindow] + 83
[...]
0x1017e3c83: addq $0x8, %rsp
0x1017e3c87: popq %rbx
0x1017e3c88: popq %rbp
0x1017e3c89: ret
However, that function would get called by AppKit like this:
AppKit`-[NSApplication makeWindowsPerform:inOrder:]:
[...]
0x7fff8b5e770d: movq %rbx, %rdi
0x7fff8b5e7710: movq -0x187e90a7(%rip), %rsi ; "performSelector:"
0x7fff8b5e7717: movq -0x40(%rbp), %rdx
0x7fff8b5e771b: callq *-0x18931e99(%rip) ; (void
*)0x00007fff81b6b240: objc_msgSend
-> 0x7fff8b5e7721: testq %rax, %rax
Note that the caller is expecting the return value to have been extended to the
full width of %rax.
I'm not sure what the AppKit code is doing or what "performSelector" is, but
presumably there's some mismatch in the expected return type.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>