Bug 371061

Summary: memcheck/tests/demangle has undefined references with clang
Product: [Developer tools] valgrind Reporter: Austin English <austinenglish>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: 3.12 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Austin English 2016-10-18 06:45:46 UTC
clang -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector -Wno-unused-private-field     -m64    -o demangle demangle.o  
demangle.o: In function `main':
/home/austin/src/valgrind/memcheck/tests/demangle.cpp:25: undefined reference to `operator new(unsigned long)'
/home/austin/src/valgrind/memcheck/tests/demangle.cpp:27: undefined reference to `operator new(unsigned long)'
demangle.o: In function `magic<int>::xyzzy(int*)':
/home/austin/src/valgrind/memcheck/tests/demangle.cpp:19: undefined reference to `operator new(unsigned long)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:1917: recipe for target 'demangle' failed
make[5]: *** [demangle] Error 1
make[5]: Leaving directory '/tmp/valgrind-clang/memcheck/tests'

works with:
austin@debian-laptop:/tmp/valgrind-clang$ gcc --version
gcc (Debian 6.2.0-6) 6.2.0 20161010
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

fails with:
austin@debian-laptop:/tmp/valgrind-clang$ clang --version
clang version 3.8.1-12 (tags/RELEASE_381/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

r16070, debian sid.

Reproducible: Always

Steps to Reproduce:
1. ./configure CC=clang CXX=clang
2. make -j8
3. make check
Comment 1 Austin English 2016-10-19 05:40:07 UTC
User error, I had CC=clang / CXX=clang, when it should've been CC=clang CXX=clang++

So unless we want to add a sanity check to configure, this is invalid.