Linking using g++ fails searching for -lstdc++

Posting for future reference, a solution I found was to install g++-multilib. I had the same incompatible problem relating to -lstdc++ on g++ version 4.6.1 On further probing: g++-multilib is a dummy package which installed g++4.6-multilib which in turn installed the appropriate libstdc++.so under the /usr/lib/gcc/x86_64-linux-gnu/4.6/32 folder.

Valgrind Unrecognised instruction

In fact, Valgrind emulate your program with an intermediate language (VEX) to know if it discovers memory violation. This VEX language capture all the instructions of several assemblers such as i386, amd64, arm, … But, from time to time, it miss a few instructions (especially specialized ones like rdrand which is linked to the AES … Read more

Double free in the C++ standard library using only std::function and std::shared_pointer

I believe the relevant part of the standard is [res.on.objects], which states If an object of a standard library type is accessed, and the beginning of the object’s lifetime does not happen before the access, or the access does not happen before the end of the object’s lifetime, the behavior is undefined unless otherwise specified. … Read more

Bug in the C++ standard library in std::poisson_distribution?

My system is set up as follows (Debian testing): libstdc++-7-dev: Installed: 7.2.0-16 libc++-dev: Installed: 3.5-2 clang: Installed: 1:3.8-37 g++: Installed: 4:7.2.0-1d1 I can confirm the bug when using libstdc++: g++ -o pois_gcc -std=c++11 pois.cpp clang++ -o pois_clang -std=c++11 -stdlib=libstdc++ pois.cpp clang++ -o pois_clang_libc -std=c++11 -stdlib=libc++ pois.cpp Result:

Is it okay to define a totally general swap() function?

unique_ptr<T> requires T* to be a NullablePointer [unique.ptr]p3 NullablePointer requires lvalues of T* to be Swappable [nullablepointer.requirements]p1 Swappable essentially requires using std::swap; swap(x, y); to select an overload for x, y being lvalues of type T* [swappable.requirements]p3 In the last step, your type foo::bar produces an ambiguity and therefore violates the requirements of unique_ptr. libstdc++’s … Read more

What configure options were used when building gcc / libstdc++?

gcc -v prints out the configuration options among other stuff: $ gcc -v Using built-in specs. Target: i686-pc-cygwin Configured with: /gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3.4/ configure –srcdir=/gnu/gcc/releases/packaging/4.3.4-3/gcc4-4.3.4-3/src/gcc-4.3. 4 –prefix=/usr –exec-prefix=/usr –bindir=/usr/bin –sbindir=/usr/sbin –libex ecdir=/usr/lib –datadir=/usr/share –localstatedir=/var –sysconfdir=/etc –inf odir=/usr/share/info –mandir=/usr/share/man –datadir=/usr/share –infodir=/usr /share/info –mandir=/usr/share/man -v –with-gmp=/usr –with-mpfr=/usr –enable -bootstrap –enable-version-specific-runtime-libs –with-slibdir=/usr/bin –libe xecdir=/usr/lib –enable-static –enable-shared –enable-shared-libgcc –disable -__cxa_atexit –with-gnu-ld … Read more

Where can I find GLIBCXX_3.4.29?

sudo add-apt-repository ppa:ubuntu-toolchain-r/test # Ignore if not ubuntu sudo apt-get update sudo apt-get install gcc-4.9 sudo apt-get upgrade libstdc++6 After this is complete, make sure to run the following: sudo apt-get dist-upgrade Also, make sure to confirm the necessary dependencies are installed for the right GLIBCXX version. strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX Also try the … Read more

std::vector (ab)uses automatic storage

There is no limit on how much automatic storage any std API uses. They could all require 12 terabytes of stack space. However, that API only requires Cpp17DefaultInsertable, and your implementation creates an extra instance over what is required by the constructor. Unless it is gated behind detecting the object is trivially ctorable and copyable, … Read more