[LLVMbugs] [Bug 20826] New: compiled code crash in std::string destructor in lambda capture on PPC 32
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Sep 1 10:14:37 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20826
Bug ID: 20826
Summary: compiled code crash in std::string destructor in
lambda capture on PPC 32
Product: clang
Version: trunk
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: bayoubengal at mac.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140901/8ec5253b/attachment.html>
More information about the llvm-bugs
mailing list