[LLVMbugs] [Bug 10119] New: Placement new bug with -O2 or -O3 and -DNDEBUG
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jun 10 08:17:00 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10119
Summary: Placement new bug with -O2 or -O3 and -DNDEBUG
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: m95lah at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=6725)
--> (http://llvm.org/bugs/attachment.cgi?id=6725)
Program that demonstrates bug.
I am experiencing a problem when building some c++ code with -O2 or -O3 and
-DNDEBUG.
It seems to be related to a use of placement new, but it could be something
else as well.
The problem occurs when using Boost.Interprocess 1.46 shared memory strings. It
appears that the internal string does not get correctly null terminated. E.g.
calling c_str() returns a string that is not null terminated.
Attached is a snippet of code that, if compiled with -O2 -DNDEBUG -lrt
-lpthread shows the problem.
It will allocate a bunch of short strings and compare it with .c_str(). If a
string fails to compare correctly it will print the strings.
I'm using ubuntu natty 64bit with clang/llvm svn r131788/r131725.
I've tried to rearrange some of the code in
boost/interprocess/containers/container/boost.hpp to see if I could see any
specific construction that causes this problem, but when I move stuff around
(e.g. priv_construct_null(...) the problem disappears.
So I am guessing this is either to do with the placement new that is performed
further into the code from priv_construct_null, or some optimization that
removes the function altogether...
I'd be happy to help by providing more info or testing things.
/Lars
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list