Package: libstdc++6
Version: 5.2.1-20
Severity: normal
Control: tags jessie sid

**********

On Linux, the distros often use libstdc++ (GNU) rather than libc++
(LLVM) for Clang. Building libcxx is an art that I have never been
able to untangle, and I think the maintainers have discovered the same
(libc++ was not installed with Clang).

Below, I'm catching a UB finding when using Clang and libstdc++ (GNU).
This one has been around for some time. I first encountered it on
Apple platforms. I regularly encounter it on Debian and Ubuntu.

The fix is fairly easy, and I usually just do it: a couple of casts
among unsigned and the flags. Also see
http://lists.llvm.org/pipermail/cfe-dev/2015-January/040753.html.

**********

$ cat ub.cxx
#include <iostream>

int main(int argc, char* argv[])
{
  std::cout << std::hex << argc << std::endl;
  std::cout << std::dec << argc << std::endl;
  return 0;
}

$ clang++ -fsanitize=undefined ub.cxx -o ub.exe

$ ./ub.exe
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/c++/5.2.1/bits/ios_base.h:102:24:
runtime error: load of value 4294967221, which is not a valid value
for type 'std::_Ios_Fmtflags'
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/c++/5.2.1/bits/ios_base.h:82:67:
runtime error: load of value 4294967221, which is not a valid value
for type 'std::_Ios_Fmtflags'
1
1

**********

$ g++ --version
g++ (Debian 5.2.1-20) 5.2.1 20151002
Copyright (C) 2015 Free Software Foundation, Inc.

$ uname -a
Linux debian-8-x64 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u5
(2015-10-09) x86_64 GNU/Linux

$ lsb_release
No LSB modules are available.

**********

$ apt-cache show libstdc++
Package: libstdc++6
Status: install ok installed
Priority: important
Section: libs
Installed-Size: 1959
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Architecture: amd64
Multi-Arch: same
Source: gcc-5
Version: 5.2.1-20
Replaces: libstdc++6-5-dbg (<< 4.9.0-3)
Depends: gcc-5-base (= 5.2.1-20), libc6 (>= 2.18), libgcc1 (>= 1:4.1.1)
Breaks: blockattack (<= 1.4.1+ds1-2.1+b2), boo (<=
0.9.5~git20110729.r1.202a430-2), c++-annotations (<= 10.2.0-1),
clustalx (<= 2.1+lgpl-3), dff (<= 1.3.0+dfsg.1-4.1+b3),
digikam-private-libs (<= 4:4.4.0-1.1+b2), emscripten (<= 1.22.1-1),
ergo (<= 3.4.0-1), fceux (<= 2.2.2+dfsg0-1), fiona (<= 1.5.1-2), flush
(<= 0.9.12-3.1), freeorion (<= 0.4.4+git20150327-2), fslview (<=
4.0.1-4), fwbuilder (<= 5.1.0-4), gcc-4.3 (<< 4.3.6-1), gcc-4.4 (<<
4.4.6-4), gcc-4.5 (<< 4.5.3-2), gnote (<= 3.16.2-1), gnudatalanguage
(<= 0.9.5-2+b2), innoextract (<= 1.4-1+b1), libantlr-dev (<=
2.7.7+dfsg-6), libapache2-mod-passenger (<= 5.0.7-1), libaqsis1 (<=
1.8.2-1), libassimp3 (<= 3.0~dfsg-4), libboost-date-time1.54.0,
libboost-date-time1.55.0, libchemps2-1 (<= 1.5-1), libcpprest2.4 (<=
2.4.0-2), libdap17 (<= 3.14.0-2), libdapclient6 (<= 3.14.0-2),
libdapserver7 (<= 3.14.0-2), libdavix0 (<= 0.4.0-1+b1), libdballe6 (<=
6.8-1), libdiet-admin2.8 (<= 2.8.0-1+b3), libdiet-client2.8 (<=
2.8.0-1+b3), libdiet-sed2.8 (<= 2.8.0-1+b3), libfreefem++ (<=
3.37.1-1), libgazebo5 (<= 5.0.1+dfsg-2.1), libgetfem4++ (<=
4.2.1~beta1~svn4635~dfsg-3+b1), libgmsh2 (<= 2.9.3+dfsg1-1),
libinsighttoolkit4.7 (<= 4.7.2-2), libkolabxml1 (<= 1.1.0-3),
libmarisa0 (<= 0.2.4-8), libogre-1.8.0 (<= 1.8.0+dfsg1-7+b1),
libogre-1.9.0 (<= 1.9.0+dfsg1-4), libopenwalnut1 (<=
1.4.0~rc1+hg3a3147463ee2-1+b1), libpqxx-4.0 (<= 4.0.1+dfsg-3),
libreoffice-core (<= 1:4.4.5-2), librime1 (<= 1.2+dfsg-2),
libwibble-dev (<= 1.1-1), libwreport2 (<= 2.14-1), libxmltooling6 (<=
1.5.3-2.1), lightspark (<= 0.7.2+git20150512-2+b1), mira-assembler (<=
4.9.5-1), mongodb (<= 1:2.4.14-2), mongodb-server (<= 1:2.4.14-2),
ncbi-blast+ (<= 2.2.30-4), openscad (<= 2014.03+dfsg-1+b1),
passepartout (<= 0.7.1-1.1), pdf2djvu (<= 0.7.21-2), photoprint (<=
0.4.2~pre2-2.3+b2), plastimatch (<= 1.6.2+dfsg-1), plee-the-bear (<=
0.6.0-3.1), povray (<= 1:3.7.0.0-8), powertop (<= 2.6.1-1),
printer-driver-brlaser (<= 3-3), psi4 (<= 4.0~beta5+dfsg-2+b1),
python-fiona (<= 1.5.1-2), python-guiqwt (<= 2.3.1-1), python-healpy
(<= 1.8.1-1+b1), python-htseq (<= 0.5.4p3-2), python-imposm (<=
2.5.0-3+b2), python-pysph (<= 0~20150606.gitfa26de9-5),
python-rasterio (<= 0.24.0-1), python-scipy (<= 0.14.1-1), python-sfml
(<= 2.2~git20150611.196c88+dfsg-1+b1), python3-fiona (<= 1.5.1-2),
python3-scipy (<= 0.14.1-1), python3-sfml (<=
2.2~git20150611.196c88+dfsg-1+b1), python3-taglib (<=
0.3.6+dfsg-2+b2), realtimebattle (<= 1.0.8-14), ruby-passenger (<=
5.0.7-1), schroot (<= 1.6.10-1+b1), sqlitebrowser (<= 3.5.1-3),
tecnoballz (<= 0.93.1-6), wesnoth-1.12-core (<= 1:1.12.4-1), widelands
(<= 1:18-3+b1), xflr5 (<= 6.09.06-2)
Conflicts: scim (<< 1.4.2-1)
Description-en: GNU Standard C++ Library v3
 This package contains an additional runtime library for C++ programs
 built with the GNU compiler.
 .
 libstdc++-v3 is a complete rewrite from the previous libstdc++-v2, which
 was included up to g++-2.95. The first version of libstdc++-v3 appeared
 in g++-3.0.
Description-md5: 724ab84919e0e220afb960e36463914d
Homepage: http://gcc.gnu.org/


**********

$ apt-cache show g++
Package: g++
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 17
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Architecture: amd64
Source: gcc-defaults (1.145)
Version: 4:5.2.1-4
Provides: c++-compiler
Depends: cpp (>= 4:5.2.1-4), gcc (>= 4:5.2.1-4), g++-5 (>= 5.2.1-13~),
gcc-5 (>= 5.2.1-13~)
Suggests: g++-multilib
Description-en: GNU C++ compiler
 This is the GNU C++ compiler, a fairly portable optimizing compiler for C++.
 .
 This is a dependency package providing the default GNU C++ compiler.
Description-md5: 4d44b18774ae5123b7c3f70d940cf655

Package: g++
Source: gcc-defaults (1.136)
Version: 4:4.9.2-2
Installed-Size: 34
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Architecture: amd64
Provides: c++-compiler
Depends: cpp (>= 4:4.9.2-2), gcc (>= 4:4.9.2-2), g++-4.9 (>=
4.6.4-1~), gcc-4.9 (>= 4.6.4-1~)
Suggests: g++-multilib
Description-en: GNU C++ compiler
 This is the GNU C++ compiler, a fairly portable optimizing compiler for C++.
 .
 This is a dependency package providing the default GNU C++ compiler.
Description-md5: 4d44b18774ae5123b7c3f70d940cf655
Build-Essential: yes
Tag: devel::compiler, devel::lang:c++, implemented-in::c,
 interface::commandline, role::dummy, role::metapackage, suite::gnu,
 works-with::software:source
Section: devel
Priority: optional
Filename: pool/main/g/gcc-defaults/g++_4.9.2-2_amd64.deb
Size: 1530
MD5sum: cd4aa68ba8cf582df806c324988e6a00
SHA1: 82a50c84e1105e1f0c767da82c09f2398ac2d4b2
SHA256: 6fb9842c6a0ad0cd5445b9f2f2cb3f738abcc83a6b8e0900aad441574f5cecee

Reply via email to