[LLVMbugs] [Bug 19660] New: Can't build application with redefined new/delete and ASAN (multiple definition of "operator new")
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 6 03:35:14 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19660
Bug ID: 19660
Summary: Can't build application with redefined new/delete and
ASAN (multiple definition of "operator new")
Product: compiler-rt
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: altsysrq at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 12480
--> http://llvm.org/bugs/attachment.cgi?id=12480&action=edit
Test file with redefined "operator new"
Following test code fails to build with enabled ASAN:
$ cat custom_new.cpp
#include <stdexcept>
void * operator new(std::size_t)
{
throw std::bad_alloc();
}
int main()
{
}
$ clang++ -Wall -O0 -fsanitize=address -std=c++11 custom_new.cpp
/tmp/custom_new-015fb3.o: In function `operator new(unsigned long)':
custom_new.cpp:(.text+0x0): multiple definition of `operator new(unsigned
long)'
/usr/bin/../lib/clang/3.4/lib/linux/libclang_rt.asan-x86_64.a(asan_new_delete.o):(.text+0x10):
first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Without replacing new operator program builds and works with ASAN enabled.
Same file builds with enabled ASAN using GCC 4.8:
$ g++ -Wall -O0 -fsanitize=address -std=c++11 custom_new.cpp
$ clang++ --version
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
On Ubuntu 14.04.
--
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/20140506/5b0efa1e/attachment.html>
More information about the llvm-bugs
mailing list