Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 585540 - sci-libs/clipper-2.1.20140911 fails to build with gcc-6: clipper/core/spacegroup_data.cpp:198:1: error: narrowing conversion of ‘2610067359u’ from ‘unsigned int’ to ‘int’ inside { } [-Wnarrowing]
Summary: sci-libs/clipper-2.1.20140911 fails to build with gcc-6: clipper/core/spacegr...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Chemistry-Related Packages
Depends on:
Blocks: gcc-6
  Show dependency tree
Reported: 2016-06-10 16:37 UTC by David Kredba
Modified: 2016-09-15 00:40 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

clipper-2.1.20140911-gcc6.patch (clipper-2.1.20140911-gcc6.patch,740 bytes, patch)
2016-06-19 21:28 UTC, Peter Levine
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kredba 2016-06-10 16:37:10 UTC
sci-libs/clipper-2.1.20140911 fails to build with gcc-6:

/bin/sh ../../libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sci-libs/clipper-2.1.20140911/work/clipper-2.1.20140911/clipper/core -I../..     -O2 -march=core2 -ggdb -pipe -fno-strict-aliasing -c -o libclipper_core_la-spacegroup_data.lo `test -f 'spacegroup_data.cpp' || echo '/var/tmp/portage/sci-libs/clipper-2.1.20140911/work/clipper-2.1.20140911/clipper/core/'`spacegroup_data.cpp
libtool: compile:  x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sci-libs/clipper-2.1.20140911/work/clipper-2.1.20140911/clipper/core -I../.. -O2 -march=core2 -ggdb -pipe -fno-strict-aliasing -c /var/tmp/portage/sci-libs/clipper-2.1.20140911/work/clipper-2.1.20140911/clipper/core/spacegroup_data.cpp  -fPIC -DPIC -o .libs/libclipper_core_la-spacegroup_data.o
/var/tmp/portage/sci-libs/clipper-2.1.20140911/work/clipper-2.1.20140911/clipper/core/spacegroup_data.cpp:198:1: error: narrowing conversion of ‘2610067359u’ from ‘unsigned int’ to ‘int’ inside { } [-Wnarrowing]

Workaround is to use CPPFLAGS="-std=gnu++98".

Portage 2.3.0_rc1 (python 2.7.11-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-6.1.1, glibc-2.23-r2, 4.6.1-gentoo x86_64)
System uname: Linux-4.6.1-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9550_@_2.83GHz-with-gentoo-2.2
KiB Mem:     8169824 total,   2802952 free
KiB Swap:    8396796 total,   8396796 free
Timestamp of repository gentoo: Fri, 10 Jun 2016 04:00:01 +0000
sh bash 4.3_p42-r2
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r2::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo, 3.5.1-r3::gentoo
dev-util/cmake:           3.5.2-r1::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.21::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.9.6-r4::gentoo, 1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.4::x-portage, 5.4.0::x-portage, 6.1.1::x-portage
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2-r2::gentoo
sys-kernel/linux-headers: 4.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /usr/local/portage
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -march=core2 -ggdb -pipe"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=core2 -ggdb -pipe"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nostrip parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=core2 -ggdb -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="X a52 aac aalib acl acpi alsa amd64 argyllcms berkdb blas bluetooth branding bzip2 cairo caps cdda cddb cdparanoia cdr cli consolekit cracklib crypt cups cvs cxx dbus declarative djvu dri dts dv dvb dvd dvdr emboss encode exif fam ffmpeg fftw firefox flac fontconfig fortran ftp gd gdbm geoip gif glamor gmp gnuplot gpm gps graphviz gsl gsm gstreamer gtk hdf5 iconv icu idn ieee1394 imagemagick imlib ipv6 ithreads javascript jbig jpeg jpeg2k kde kipi ladspa lame lapack lcms ldap libass libnotify libsamplerate lzma lzo mad matroska mms mmx mmxext mng modplug modules mp3 mp4 mpeg mplayer mtp multilib musepack musicbrainz ncurses netcdf nls nptl ogg opencl openexr opengl openmp pam pango pch pcre pdf perl phonon pic plasma plotutils png policykit postscript ppds pulseaudio python qml qt3support qt4 qt5 quicktime rdesktop readline sdl seccomp semantic-desktop session slang smp sndfile sox speex spell sse sse2 ssl ssse3 startup-notification svg szip tcpd theora threads tidy tiff truetype udev udisks unicode upower usb v4l vaapi vcd vdpau vnc vorbis wavpack widgets wmf wxwidgets x264 xattr xcb xcomposite xft xine xinerama xml xosd xpm xscreensaver xv xvid xvmc zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="author braindump flow karbon kexi krita plan sheets stage words" CAMERAS="ptp2 adc65 agfa_cl20 aox ax203 barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 jl2005a jl2005c kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 pentax polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ricoh ricoh_g3 samsung sierra sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 st2205 stv0674 stv0680 sx330z topfield toshiba_pdrm11 tp6801" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3" CURL_SSL="gnutls" ELIBC="glibc" FFTOOLS="aviocat cws2fws ffescape ffeval fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart trasher ffhash" GPSD_PROTOCOLS="aivdm ashtech earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 navcom nmea ntrip oceanserver oncore rtcm104v2 rtcm104v3 sirf superstar2 tnt tripmate tsip ubx fury geostar nmea2000" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer scripting-beanshell scripting-javascript nlpsolver" LINGUAS="cs en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" QEMU_SOFTMMU_TARGETS="x86_64 arm i386" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby20" USERLAND="GNU" VIDEO_CARDS="nouveau radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.4 3.5"
Comment 1 Peter Levine 2016-06-19 21:28:05 UTC
Created attachment 438058 [details, diff]

I don't actually use this package but it should be as simple as switching int to unsigned.  Still, someone should make sure that dependent packages work fine.
Comment 2 David Seifert gentoo-dev 2016-09-14 20:43:01 UTC
@Peter, thanks for the patch, but you're actively changing the semantics of the code. Changing a signed to an unsigned int could have catastrophic consequences. Instead, the proper way to approach these C++14 narrowing issues is to add explicit casts to the actual type (int in this case), such that the previous C++98 behaviour is restored. While this code is still pretty smelly as such, at least the semantics remain the same between -std=c++98 and -std=c++14. Have a look at how Aric fixes the -Wnarrowing conversions in C++14 mode:

commit 60f24d005e5b18ece03fcac0576023bded6354f6
Author: David Seifert <>
Date:   Wed Sep 14 22:36:13 2016 +0200

    sci-libs/clipper: Allow for compiling with GCC 6
    Gentoo-bug: 585540
    * EAPI=6
Comment 3 Peter Levine 2016-09-15 00:40:08 UTC
(In reply to David Seifert from comment #2)
> Changing a signed to an unsigned int could have catastrophic
> consequences. Instead, the proper way to approach these C++14 narrowing
> issues is to add explicit casts to the actual type (int in this case), such
> that the previous C++98 behaviour is restored.

I agree.  Tentatively, it looked like the signage was irrelevant to its use but it is better to be true to the original behavior if it caused no breakage.