<html>
<head>
<base href="http://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 --- - compiled code crash in std::string destructor in lambda capture on PPC 32"
href="http://llvm.org/bugs/show_bug.cgi?id=20826">20826</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>compiled code crash in std::string destructor in lambda capture on PPC 32
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bayoubengal@mac.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I'm cross-compiling. host == OSX 10.9. target == -target powerpc-unknown-linux
-m32 -mcpu=e500v2 -std=c++14. clang code version == 'clang version 3.6.0 (trunk
216704)' std lib flag == '-stdlib=libc++'. optimization flags == '-g -O0'
The code crashes in the basic_string destructor with the system complaining of
a double free of a pointer. I do indeed see this pointer being passed to free()
multiple times. However, I have no discerned if the pointer is being
reallocated each time.
message from system == '*** glibc detected *** /test/testPocosn_static: double
free or corruption (fasttop): 0x100940e0 ***
======= Backtrace: ========='
partial backtrace of the crash...
#4 0x1000673c in deallocate (this=0x8214924e, __p=0x4 <error: Cannot access
memory at address 0x4>)
at
/Volumes/dev/devel/testPoco/../PrgSDK_1/comx_p2020/supernode_3/linuxSDK3.8/usr/include/c++/v1/memory:1636
#5 deallocate (__a=..., __p=0x0, __n=0) at
/Volumes/dev/devel/testPoco/../PrgSDK_1/comx_p2020/supernode_3/linuxSDK3.8/usr/include/c++/v1/memory:1447
#6 std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >::~basic_string (this=0x0)
at
/Volumes/dev/devel/testPoco/../PrgSDK_1/comx_p2020/supernode_3/linuxSDK3.8/usr/include/c++/v1/string:2244
#7 0x8256c9a2 in ?? ()
code snippet:
(This code runs fine when targeting OSX 10.9/x86_64)
#include <string>
#include <memory>
#include <iostream>
#include <future>
int main(int argc, char** argv)
{
std::string tmpCaptureTest="test a captured string";
auto tmpCallback = [=](const std::string& s, int i , double d)
{
std::cout << tmpCaptureTest << s << i << d << std::endl;
return 43;
};
std::packaged_task<int (const std::string& s, int i , double d)>
tmpTask(tmpCallback);
std::future<int> tmpTaskResult = tmpTask.get_future();
auto tmpArg1 = "test";
auto tmpArg2 = 56;
auto tmpArg3 = 3.7;
auto tmpDispatchCallbackWrapper = [=, tmpTask2 = std::move(tmpTask)] ()
mutable
{
tmpTask2(tmpArg1, tmpArg2, tmpArg3);
};
return 0;
}</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>