<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 - Clang crashes with allocator aware coroutines"
href="https://bugs.llvm.org/show_bug.cgi?id=49083">49083</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crashes with allocator aware coroutines
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rst-mlngsts@protonmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24495" name="attach_24495" title="Test program 1">attachment 24495</a> <a href="attachment.cgi?id=24495&action=edit" title="Test program 1">[details]</a></span>
Test program 1
Attached test programs crash the compiler as such:
clang -cc1 -O2 -std=gnu++2a -emit-llvm corobug1.cpp
Instruction does not dominate all uses!
%FramePtr = bitcast i8* %7 to %_ZN7derived9make_taskE12service_type.Frame*
%service3.sroa.0.0.copyload53.spill.addr = getelementptr inbounds
%_ZN7derived9make_taskE12service_type.Frame,
%_ZN7derived9make_taskE12service_type.Frame* %FramePtr, i32 0, i32 8
fatal error: error in backend: Broken function
And the second:
clang -cc1 -O2 -std=gnu++2a -emit-llvm corobug2.cpp
Instruction does not dominate all uses!
%FramePtr = bitcast i8* %6 to %_Z10make_task212service_type.Frame*
%service1.sroa.0.0.copyload.spill.addr = getelementptr inbounds
%_Z10make_task212service_type.Frame, %_Z10make_task212service_type.Frame*
%FramePtr, i32 0, i32 7
fatal error: error in backend: Broken function
Affects versions 11.0.1 and 11.1.0-rc3 at least. Works fine in clang-10.0.1
however. But I had similar failures in 10.0.1 at some point and I could go
hunting for those if required.
These are creduce'd results that I hand edited a little bit of sense back into.
The common theme is that operator new of a coroutine promise is used to perform
custom memory allocation based on function parameters provided to the coroutine
function.
Issue appears under seemingly random conditions with -O2 and -O3. If you poke
around in the test programs and remove what looks like irrelevant things like
"int dummy" members or change the make_task method to be non-virtual (or remove
the base class), it suddenly passes.
The variadic operator new in corobug1.cpp seemed like a smoking gun at first.
You can replace that with a non-variadic definition to get it to pass also. But
then I found corobug2.cpp which depends on no such condition. This whole thing
feels like the optimizer has to be coaxed into just the right conditions to
break.</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>