<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 - Wrong jump destination with -O2 -fexperimental-new-pass-manager"
href="https://bugs.llvm.org/show_bug.cgi?id=45858">45858</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong jump destination with -O2 -fexperimental-new-pass-manager
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>leamovret@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Here's a reduced PoC on Compiler Explorer with clang (trunk):
<a href="https://gcc.godbolt.org/z/ZKn7Uq">https://gcc.godbolt.org/z/ZKn7Uq</a>.
(This is a reduced version of Chromium's file
//sandbox/win/src/filesystem_interception.cc.)
You can see the problem in the middle column. The right column (with -Os)
demonstrates an expected behavior.
The problem happens at the if statement at the line 132888.
(In Chromium, it's
<a href="https://source.chromium.org/chromium/chromium/src/+/master:sandbox/win/src/crosscall_params.h;l=251;drc=c8cff7f9663ce6d1ef35e5c717f43c867c3906eb">https://source.chromium.org/chromium/chromium/src/+/master:sandbox/win/src/crosscall_params.h;l=251;drc=c8cff7f9663ce6d1ef35e5c717f43c867c3906eb</a>.)
if ((size > sizeof(*this)) ||
(param_info_[index].offset_ > (sizeof(*this) - size))) {
// It does not fit, abort copy.
return false;
}
In both the repro and the expected behavior, the second condition is compiled
into "cmp rdx, rcx; jae", where rdx = (sizeof(*this) - size) and rcx =
param_info_[index].offset_. So the destination of the JAE must be the code
after the if statement.
In the repro case, however, the destination is .LBB2_9, which is the code
inside the if block. I think the label .LBB2_9 must be placed at the "%bb.8".
This is not breaking Chromium because it's compiled with -Os, and
-fexperimental-new-pass-manage is not set. I hit this when working on Firefox,
which imports some of Chromium code, and Mozilla recently enabled
-fexperimental-new-pass-manager.</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>