I had to rebuild flac last week (2020-04-22T16:40:06). After this rebuild, "flac -t" (checksum test) fails for some (<< 0.01%) of my flac files, despite a md5sum is listed with metaflac. Sadly, I do not remember the reason for the rebuild. I weekly check my entire collection for checksum errors. It worked at 20-04-20T16:41, and failed at 20-04-27T03:30. Here is an example: $ flac -t *.flac flac 1.3.3 Copyright (C) 2000-2009 Josh Coalson, 2011-2016 Xiph.Org Foundation flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Type `flac' for details. 01 - Pleiadians - The Pleiadians.flac: ok 02 - Pleiadians - Boarding Pass To Balangan.flac: ok 03 - Pleiadians - Cyberland.flac: ok 04 - Pleiadians - Sonic System.flac: ok 05 - Pleiadians - Analogue Step.flac: ok 06 - Pleiadians - Jungle Trax.flac: ok 07 - Pleiadians - Zeta Reticuli.flac: ok 08 - Pleiadians - Deep Frequencies.flac: WARNING, cannot check MD5 signature since it was unset in the STREAMINFO ok $ metaflac --show-md5sum *.flac 01 - Pleiadians - The Pleiadians.flac:06fff275d1319ec1fdb5291d2ff140f1 02 - Pleiadians - Boarding Pass To Balangan.flac:a81f75f568a806914cf625e61119c210 03 - Pleiadians - Cyberland.flac:8710758f4580207ca7de6c65684c28e2 04 - Pleiadians - Sonic System.flac:2ce92324eb2a39808eaf9bdffd4b7638 05 - Pleiadians - Analogue Step.flac:c6c2f5538c270fd402e66c34dcb39752 06 - Pleiadians - Jungle Trax.flac:470af7e755baebe4992e3ff1da40e3a4 07 - Pleiadians - Zeta Reticuli.flac:59717a2e3b01eae30554ec82531dfd9a 08 - Pleiadians - Deep Frequencies.flac:00d1a45269fab1c89a4f828b055b2cdd I checked for real corruptions using a backup from 2020-04-19. Thus, the check was working after the backup, i.e., we can assume the backup is not corrupt. Both versions show the fthe same md5sum: $ md5sum 08\ -\ Pleiadians\ -\ Deep\ Frequencies.flac f52a46fc16f4dec212db518c67c1fef8 08 - Pleiadians - Deep Frequencies.flac # qlop -mv flac | tail -n2 2019-12-02T14:05:07 >>> media-libs/flac-1.3.3 2020-04-22T16:40:06 >>> media-libs/flac-1.3.3 Thus, thus is not a version problem here. It has to do with some linked libraries or some build changes. Furthermore, it appears random among the collection. Thus, it does not seem to be linked to a systematic error of a flac compiler (version) (In this case I would expect complete albums to fail). Reproducible: Always
# emerge --info flac Portage 2.3.89 (python 3.6.10-final-0, default/linux/amd64/17.1/no-multilib/hardened, gcc-9.3.0, glibc-2.29-r7, 5.5.13-gentoo x86_64) ================================================================= System Settings ================================================================= System uname: Linux-5.5.13-gentoo-x86_64-Intel-R-_Core-TM-_i5-4570S_CPU_@_2.90GHz-with-gentoo-2.6 KiB Mem: 16263792 total, 1427508 free KiB Swap: 16777212 total, 16107260 free Timestamp of repository gentoo: Wed, 22 Apr 2020 12:41:33 +0000 Head commit of repository gentoo: ad3c320897a26ac2fb4f138e0e6136dd74d6a39b sh bash 4.4_p23-r1 ld GNU ld (Gentoo 2.33.1 p2) 2.33.1 app-shells/bash: 4.4_p23-r1::gentoo dev-lang/perl: 5.30.1::gentoo dev-lang/python: 2.7.17-r2::gentoo, 3.6.10-r1::gentoo, 3.7.7-r1::gentoo dev-util/cmake: 3.16.5::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.6-r1::gentoo sys-apps/openrc: 0.42.1::gentoo sys-apps/sandbox: 2.13::gentoo sys-devel/autoconf: 2.69-r4::gentoo sys-devel/automake: 1.16.1-r1::gentoo sys-devel/binutils: 2.33.1-r1::gentoo sys-devel/gcc: 9.3.0::gentoo sys-devel/gcc-config: 2.2.1::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.2.1-r4::gentoo sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers) sys-libs/glibc: 2.29-r7::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 sync-git-verify-commit-signature: true shared_overlay location: /opt/conf/common/var/db/repos/shared_overlay masters: gentoo priority: 100 local_overlay location: /var/db/repos/local_overlay masters: gentoo priority: 200 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -ftree-vectorize -fforce-addr" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/portage/package.accept_keywords/99-autounmask /etc/portage/package.unmask/99-autounmask /etc/portage/package.use/99-autounmask /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=native -O2 -pipe -ftree-vectorize -fforce-addr" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y --autounmask=y --autounmask-write --autounmask-continue --jobs=2 --load-average=4 --backtrack=100" ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" 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" PORTAGE_TMPDIR="/var/tmp" USE="acl aes amd64 avx avx2 bash-completion bzip2 crypt cups dnssec f16c fma3 glib hardened iconv icu idn ipv4 ipv6 libtirpc lvm mmx mmxext ncurses nfsv4 nls nptl ntp openmp opensslcrypt pam pclmul pcre pie popcnt readline samba seccomp split-usr sse sse2 sse3 sse4_1 sse4_2 ssl ssp ssse3 syslog threads unicode vim-syntax xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2018" 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel" 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" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS ================================================================= Package Settings ================================================================= media-libs/flac-1.3.3::gentoo was built with the following: USE="cxx -debug -ogg -static-libs" CPU_FLAGS_X86="sse"
Ok, i digged abit deeper, the common pattern among the files is, that the md5sum starts with 00 08 - Koxbox - Loads Of Flow (Molecular Mix).flac:002f57d986df5b8e0ae08fba7323c6a0 07 - Skizologic - Spectrum.flac:00832642cc4f9fd914b450c69ea154d7 08 - Pleiadians - Deep Frequencies.flac:00d1a45269fab1c89a4f828b055b2cdd 04 - Elysium - Dance For The Celestial Beings.flac:0005e81f442234fc1c9b3fedf28fbcd4 guess that the "is null" check might be a problem here
lated flac was build with a newer gcc here # qlop -mv gcc | tail -n2 2019-12-02T12:57:20 >>> sys-devel/gcc-9.2.0-r2 2020-04-22T18:25:58 >>> sys-devel/gcc-9.3.0 so this might cause the null check to fail here...
There is an upstream bug report with a patch attached https://sourceforge.net/p/flac/bugs/478/
Created attachment 634856 [details, diff] flac-1.3.3-fix-zero-first-byte-md5sum-check-gcc93.patch The patch from the upstream bug report works as expected. I have attached a slightly adjusted version (formatting, diff header), that has been tested on my system here.
Created attachment 634858 [details, diff] flac-1.3.3-fix-zero-first-byte-md5sum-check-gcc93.patch (rev. 2) fixed mixed tab/spaces indentation.
sry my analysis about the gcc version was wrong, working build was still on gcc 8, failing build was gcc 9 # qlop -mv gcc | tail -n3 2019-06-21T00:49:50 >>> sys-devel/gcc-8.3.0-r1 2019-12-02T12:57:20 >>> sys-devel/gcc-9.2.0-r2 2020-04-22T18:25:58 >>> sys-devel/gcc-9.3.0
Created attachment 634860 [details, diff] flac-1.3.3-fix-zero-first-byte-md5sum-check-gcc9.patch (rev 3) renaming w.r.t. gcc version
Confirm your patch fixes this issue for me. (Looks like a glibc regression.)
please add this patch to portage, upstream does not seem to be very active recently. It is a very small change which should not lead to any side effects. I am using this patch on my 800 GiB flac collection and it works flawlessly now for months. It resolved the previous issue, but real broken files are still detected.
I can confirm, that this patch fixes it. PLEASE revbump media-libs/flac with this patch. Thanks!
I have created a pull request
has anyone tested it with > static const FLAC__byte emptyMD5[16] = ... ? just asking.
it would be also interesting what triggers that bug. Maybe GCC is shortening the "string" to just "\0". perhaps one should check the ASM output... this anomaly could hit other software, too.
hmm, static const also fails
unpatched flac code fails for CFLAGS/CXXFLAGS set to "-march=native -O2 -pipe", but is fine with -O1
(In reply to Till Schäfer from comment #17) > unpatched flac code fails for CFLAGS/CXXFLAGS set to "-march=native -O2 > -pipe", but is fine with -O1 to be ore precise fine with "-march=native -O1 -pipe"
OK I do not get this, maybe shomeone can shed some light on it: When I use -01 optimization level with all the extra options for -02 enabled manually, checksum test still works, but not with -O2. To get more precise: THIS WORKS: CFLAGS="-march=native -O1 -pipe -falign-functions -falign-jumps -falign-labels -falign-loops -fcaller-saves -f code-hoisting -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize - fdevirtualize-speculatively -fexpensive-optimizations -fgcse -fgcse-lm -fhoist-adjacent-loads -finline-small-fu nctions -findirect-inlining -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp -fisolate-erroneous-pa ths-dereference -flra-remat -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2 -freorder -blocks-algorithm=stc -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -fschedule-insn s -fschedule-insns2 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing -fthread-jumps -ftree-bui ltin-call-dce -ftree-pre -ftree-switch-conversion -ftree-tail-merge -ftree-vrp" THIS FAILS CFLAGS="-march=native -O2 -pipe" # emerge --info Portage 3.0.12 (python 3.8.6-final-0, default/linux/amd64/17.1/desktop/plasma/systemd, gcc-9.3.0, glibc-2.32-r5, 5.10.6-gentoo x86_64) ================================================================= System uname: Linux-5.10.6-gentoo-x86_64-Intel-R-_Core-TM-_i7-4810MQ_CPU_@_2.80GHz-with-glibc2.2.5 KiB Mem: 16293344 total, 6208212 free KiB Swap: 16777212 total, 16777212 free Timestamp of repository gentoo: Wed, 13 Jan 2021 12:35:09 +0000 Head commit of repository gentoo: fa858e46c9a3cb1a2cb9ff4cc4394d2717ccfd0b Timestamp of repository kde: Tue, 12 Jan 2021 18:35:23 +0000 Head commit of repository kde: 2a833d6c7952037d3ab7e5d706ca13787e88bac8 Timestamp of repository steam-overlay: Tue, 12 Jan 2021 10:37:54 +0000 Head commit of repository steam-overlay: bd1215e0cf901abeb8494cba77cf12a098ae58bc sh bash 5.0_p18 ld GNU ld (Gentoo 2.34 p6) 2.34.0 app-shells/bash: 5.0_p18::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.30.3::gentoo dev-lang/python: 2.7.18-r5::gentoo, 3.7.9-r1::gentoo, 3.8.6-r1::gentoo, 3.9.0-r1::gentoo dev-util/cmake: 3.17.4-r1::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.7::gentoo sys-apps/sandbox: 2.20::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo sys-devel/automake: 1.16.2-r1::gentoo sys-devel/binutils: 2.34-r2::gentoo sys-devel/gcc: 9.3.0-r2::gentoo sys-devel/gcc-config: 2.3.2-r1::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers) sys-libs/glibc: 2.32-r5::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 sync-git-verify-commit-signature: true kde location: /var/db/repos/kde sync-type: git sync-uri: https://github.com/gentoo-mirror/kde.git masters: gentoo steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo shared_overlay location: /opt/conf/common/var/db/repos/shared_overlay masters: gentoo priority: 100 local_overlay location: /var/db/repos/local_overlay masters: gentoo priority: 200 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -ftree-vectorize -ggdb" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.6/conf" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/portage/package.accept_keywords/99-autounmask /etc/portage/package.unmask/99-autounmask /etc/portage/package.use/99-autounmask /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="-march=native -O2 -pipe -ftree-vectorize -ggdb" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--with-bdeps=y --autounmask=y --autounmask-write --autounmask-continue --jobs=2 --load-average=8 --backtrack=100" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j8" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" 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" PORTAGE_TMPDIR="/var/tmp" USE="X a52 aac acl acpi activities aes alsa amd64 apng avx avx2 bash-completion berkdb bluetooth branding brotli bzip2 cairo cdaudio cdda cddb cdparanoia cdr chm cli crypt cryptsetup cups dbus declarative djvu dnssec dri dts dvd dvdr egl emboss encode eps epub evdev exif f16c ffmpeg flac fma3 fortran gdbm gif glib gpg gpm gstreamer gtk gui gzip iconv icu id3tag idn imagemagick inotify ipv6 irc jpeg jpeg2k kde kipi kwallet lame lcms libglvnd libnotify libsamplerate libtirpc lvm lzma mad matroska mmx mmxext mng mp3 mp4 mpeg mplayer mtp multilib musicbrainz ncurses networkmanager nls nptl ntp ogg opengl openmp opus otr pam pango pclmul pcre pdf phonon plasma pm-utils png policykit popcnt ppds pulseaudio qml qt5 quicktime rar rdrand readline real rss sdl seccomp semantic-desktop spell split-usr sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 startup-notification svg systemd taglib tcpd theora threads thumbnail tiff truetype twolame udev udisks uefi unicode upower usb v4l v4l2 vaapi vcd vim-syntax visualization vorbis vpx wavpack wayland webp widgets wifi wma wmf wxwidgets x264 x265 xattr xcb xinerama xml xv xvid xvidv xvmc xz zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python2_7 python3_8" RUBY_TARGETS="ruby25 ruby26" USERLAND="GNU" VIDEO_CARDS="intel modesetting" 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" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-9.3.0-r2/work/gcc-9.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/9.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/python --enable-languages=c,c++,objc,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 9.3.0-r2 p4' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-systemtap --enable-vtable-verify --enable-lto --without-isl --enable-default-pie --enable-default-ssp
The extra options match "man gcc" and https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Optimize-Options.html
it would be nice to see the ASM output for that func. I can try to figure it out tomorrow. but I could also do a small test program to see, what GCC is doing with this memcmp().
Created attachment 683110 [details] small test program compile with: gcc -O2 -S -o test.s test.c then open test.s with editor
I already see, what the problem is. FLAC__bool is an int, rather than "bool". The result of memcmp is also an int. GCC is smart and reduces the original assignment to just: callback1: movzbl 56(%rsi), %eax movl %eax, (%rdx) ret if you compare it against 0 (!= 0), then gcc produces valid code, even w/o calling memcmp. See asm output of callback2. callback3 is the patch-variant. this also works, because it really calls memcmp. if you compile it with -O1, gcc always calls memcmp. callback3 (which is the patch-variant) produces worst code! So just adding an "!= 0" behind memcmp(...) not only fixes it, it also produces some smart code. ;-)
uh, nice analysis. I have updated the patch in the PR.
Created attachment 683134 [details, diff] flac-1.3.3-fix-zero-first-byte-md5sum-check-gcc9.patch (rev 4) updated patch (already tested working)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af0cbb0fe77ace54cb725a7202114dcc49fde239 commit af0cbb0fe77ace54cb725a7202114dcc49fde239 Author: Miroslav Šulc <fordfrog@gentoo.org> AuthorDate: 2021-01-16 12:13:24 +0000 Commit: Miroslav Šulc <fordfrog@gentoo.org> CommitDate: 2021-01-16 12:14:18 +0000 media-libs/flac: copied stable keywords + minor improvement as this is a bugfix, i copied the stable keywords to the bump Package-Manager: Portage-3.0.13, Repoman-3.0.2 Closes: https://bugs.gentoo.org/719792 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org> media-libs/flac/flac-1.3.3-r1.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=843116182c8038fb70225fa0b3b50c6008b5fef3 commit 843116182c8038fb70225fa0b3b50c6008b5fef3 Author: Till Schäfer <till2.schaefer@uni-dortmund.de> AuthorDate: 2021-01-15 09:25:53 +0000 Commit: Miroslav Šulc <fordfrog@gentoo.org> CommitDate: 2021-01-16 12:08:07 +0000 media-libs/flac: fix zero prefix md5sum check Bug: https://bugs.gentoo.org/719792 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Till Schäfer <till2.schaefer@uni-dortmund.de> Closes: https://github.com/gentoo/gentoo/pull/19064 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org> ...ac-1.3.3-fix-zero-first-byte-md5sum-check.patch | 13 +++++ media-libs/flac/flac-1.3.3-r1.ebuild | 61 ++++++++++++++++++++++ 2 files changed, 74 insertions(+)
thanks guys! :-)
please send this patch also upstream. thanks!
(In reply to Stefan Briesenick from comment #28) > please send this patch also upstream. thanks! It already is: https://sourceforge.net/p/flac/bugs/478/
(In reply to Sam James from comment #29) > (In reply to Stefan Briesenick from comment #28) > > please send this patch also upstream. thanks! > > It already is: https://sourceforge.net/p/flac/bugs/478/ this is the old patch. We have a new and better one! Please update this upstream bug-report with new patch. thanks!
Done
(In reply to Till Schäfer from comment #31) > Done thanks!