<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - [codeview] Invalid encoding of signed ints when emitting S_CONSTANTs"
href="https://bugs.llvm.org/show_bug.cgi?id=51770">51770</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[codeview] Invalid encoding of signed ints when emitting S_CONSTANTs
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>remedybg@protonmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>Signed integers are incorrectly encoded to CodeView S_CONSTANTs.
Tracked down to this commit
<a href="https://github.com/llvm/llvm-project/commit/7156910d85fcafdc78371a852c00a7184f8563cd">https://github.com/llvm/llvm-project/commit/7156910d85fcafdc78371a852c00a7184f8563cd</a>
Before this commit the constant values were encoded as expected.
Clang 12.x: S_CONSTANT: Type: T_INT4(0074), Value: (LF_CHAR) -128(0x80), E1
Clang 10.x: S_CONSTANT: Type: T_INT4(0074), Value: 128, E1
The following example demonstrates the problem.
enum {
E0 = 127, // OK: 127
E1 = 128, // FAIL: -128
E2 = 129, // FAIL: -127
E3 = 254, // FAIL: -2
E4 = 255, // FAIL: -1
E5 = 256, // FAIL: 0
E6 = 257, // FAIL: 1
E7 = 511, // FAIL: -1
E8 = 512, // FAIL: 0
E9 = 513, // FAIL: 1
};
int main() {
return E0 + E1 + E2 + E3 + E4 + E5 + E6 + E7 + E8 + E9; // ensure usage
};
(Separately, note that LLDB has a bug / missing feature where it is unable to
resolve any of these S_CONSTANTs giving the error "use of undeclared
identifier").</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>