adplug / adplay-unix

AdPlug's UNIX console-based frontend
GNU General Public License v2.0
12 stars 15 forks source link

1.8 unix fails to build with gcc 8.0.1 (fedora 29, rawhide) #10

Open rosset opened 6 years ago

rosset commented 6 years ago

Making all in src /usr/bin/make all-am make[2]: Entering directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' g++ -DHAVE_CONFIG_H -I. -I/usr/include/libbinio -DADPLUG_DATA_DIR=\"/var/lib/adplug\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -c -o output.o output.cc make[2]: Leaving directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' make[2]: Entering directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' g++ -DHAVE_CONFIG_H -I. -I/usr/include/libbinio -DADPLUG_DATA_DIR=\"/var/lib/adplug\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -c -o alsa.o alsa.cc make[2]: Leaving directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' make[2]: Entering directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' g++ -DHAVE_CONFIG_H -I. -I/usr/include/libbinio -DADPLUG_DATA_DIR=\"/var/lib/adplug\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -c -o disk.o disk.cc make[2]: Leaving directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' make[2]: Entering directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' g++ -DHAVE_CONFIG_H -I. -I/usr/include/libbinio -DADPLUG_DATA_DIR=\"/var/lib/adplug\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -c -o ao.o ao.cc make[2]: Leaving directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' adplay.cc:115:1: error: narrowing conversion of '4294967295' from 'unsigned int' to 'int' inside { } [-Wnarrowing] }; ^ make[2]: [Makefile:497: adplay.o] Error 1 make[2]: Entering directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' g++ -DHAVE_CONFIG_H -I. -I/usr/include/libbinio -DADPLUG_DATA_DIR=\"/var/lib/adplug\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -c -o adplay.o adplay.cc make[2]: Leaving directory '/home/filiperosset/rpmbuild/my/failed/adplay/adplay-1.8/src' make[1]: [Makefile:351: all] Error 2 make: *** [Makefile:404: all-recursive] Error 1 erro: Status de saída de /var/tmp/rpm-tmp.YWr9Yj inválido (%build) Status de saída de /var/tmp/rpm-tmp.YWr9Yj inválido (%build)

Erros na construção do RPM: Could not execute local: rpmbuild --define '_sourcedir /home/filiperosset/rpmbuild/my/failed/adplay' --define '_specdir /home/filiperosset/rpmbuild/my/failed/adplay' --define '_builddir /home/filiperosset/rpmbuild/my/failed/adplay' --define '_srcrpmdir /home/filiperosset/rpmbuild/my/failed/adplay' --define '_rpmdir /home/filiperosset/rpmbuild/my/failed/adplay' --define 'dist .fc29' --define 'fedora 29' --eval '%undefine rhel' --define 'fc29 1' -ba /home/filiperosset/rpmbuild/my/failed/adplay/adplay.spec | tee .build-1.8-1.fc29.log [filiperosset@raw adplay]$ gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 8.0.1 20180410 (Red Hat 8.0.1-0.21) (GCC)

Malvineous commented 6 years ago

Don't really understand this error. It's complaining that an unsigned int is being assigned a value of (unsigned int)-1 which is allowed. The complaint is that it's being converted to int but it's not. The typecast should avoid the error, unless this is some new 32-bit vs 64-bit error?

Maybe this is a bug in GCC?

ildar commented 6 years ago

With (unsigned int)-1 you mean max uint? There's a const defined for that IIRC.

Malvineous commented 6 years ago

It's not really max uint, it's more a magic number that's very unlikely to be used. It would be a shame if (unsigned int)-1 no longer works, because IMHO that's clearer than something like UINT_MAX, which suggests you want a really large number for some reason.

ildar commented 6 years ago

I see. Sounds like @Malvineous is against latest ANSI C guidelines. If I'm not mistaken this is kind of out of scope of adplug/adplay (plz excuse me).

rosset commented 6 years ago

reverting this commit fix the issue with gcc8

https://github.com/adplug/adplay-unix/commit/48dcaa87ff91369eb41998abd72e226fe138b528

Malvineous commented 6 years ago

@ildar Not against the guidelines, I just think that readable code is more important than following someone else's rules. Now that I think about it, it would be even better to do something like #define SUBSONG_NONE xxx so if someone wants to submit a patch for that I will happily apply it.

@rosset Thanks for finding the breaking commit. Looks like we can't remove the cast or a compiler warning will return with GCC < 8, so using a #define along with ildar's suggestion of UINT_MAX or similar is probably the way to go.

mywave82 commented 1 year ago

The magic number ~0 is all bits set

mywave82 commented 7 months ago

(the reason the compilation fails is due to -Werror, causing all warnings to be become errors)

@Malvineous, you decide if you want to change the code or not, and close this issue as you see fit.