I noticed that Debian package builds of both 7.8(.866-7) and 8.0(.358-1) have recently started failing on the powerpc architecture.
https://buildd.debian.org/status/fetch.php?pkg=pike8.0&arch=powerpc&...
/«PKGBUILDDIR»/build/linux-3.16.0-4-powerpc64-ppc/pike -DNOT_INSTALLED -DPRECOMPILED_SEARCH_MORE -m/«PKGBUILDDIR»/build/linux-3.16.0-4-powerpc64-ppc/master.pike /«PKGBUILDDIR»/src/post_modules/GL/gen.pike /«PKGBUILDDIR»/src/post_modules/GL/auto.c.in > auto.c.tmp Segmentation fault
This doesn't happen when pike is compiled with -O0, and 7.8.866-6 built fine (the only difference is that -7 is built with MariaDB libraries instead of MySQL), so I assume a compiler bug, but perhaps someone can help figuring out what's triggering it. The backtrace is perhaps not terribly helpful (from 8.0.358):
(gdb) bt full #0 jump_opcode_F_MARK_CALL_LFUN_AND_POP (arg1=272) at /home/zino/hack/pike8-rel/pike/src/interpret_functions.h:2418 addr = <optimized out> jumpaddr = <optimized out> #1 0xf7ceeb4c in ?? () No symbol table info available. #2 0x20462184 in mega_apply_low (args=args@entry=0, arg1=arg1@entry=0x206b6370, arg2=<optimized out>) at ./src/interpret.c:2721 saved_jmpbuf = <optimized out> uwp = {previous = 0xfffedc38, frame_pointer = 0x0, func = 0x204516a0 <restore_catching_eval_jmpbuf>, arg = 0x0} #3 0x204e4714 in call_pike_initializers (o=0x206b6370, args=args@entry=0) at ./src/object.c:338 p = 0x206b6370 #4 0x204e7b9c in get_master () at ./src/object.c:702 f = <optimized out> uwp = {previous = 0x0, frame_pointer = 0x0, func = 0x204e5b50 <get_master_cleanup>, arg = 0x0} inside = 1 #5 0x204e7f04 in debug_master () at ./src/object.c:720 o = <optimized out> #6 0x204d55cc in load_pike_master () at ./src/pike_embed.c:397 m = <optimized out> #7 0x2044724c in main (argc=6, argv=0xfffef534) at ./src/main.c:676 m = <optimized out> back = {previous = 0x0, recovery = {{__jmpbuf = {-1376152737, 0, 1917001823, 0 <repeats 13 times>, -134352256, -73784, 4, 543427968, -67736, 570426500, 0 <repeats 40 times>, -1, 0 <repeats 49 times>}, __mask_was_saved = 0, __saved_mask = {__val = {0 <repeats 32 times>}}}}, frame_pointer = 0x0, stack_pointer = 0, mark_sp = 0, severity = 40, onerror = 0xfffedbdc} e = <optimized out> num = <optimized out> p = 0xfffef767 ""
Hm, I can't reproduce with current 8.0. Are you building the 32-bit or the 64-bit ABI? What is your system compiler version? (Not clang I hope...)
The build of 7.8 that worked was with gcc-6 6.2.0-4, which according to the changelog is actually "SVN 20160914 (r240133, 6.2.1) from the gcc-6-branch." The build of 7.8 that failed was with 6.2.0-11, which is "SVN 20161103 (r241817, 6.2.1) from the gcc-6-branch".
Hm, it looks like there is an official ebuild of gcc-6 in Gentoo now (it just has the empty keyword set, indicating "probably breaks on all architectures" :), so I'll give it a spin. Which ABI did you say you were buiding?
There are both powerpc and ppc64 architectures (as well as ppc64el), and I'm actually not sure what the difference is, because both the porterbox where I reproduced the problem (which is said to be a powerpc porterbox) and a ppc64 porterbox have the same uname -a output and binaries are "ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV)".
Linux partch 3.16.0-4-powerpc64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) ppc64 GNU/Linux
Linux pizzetti 3.16.0-4-powerpc64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) ppc64 GNU/Linux
Anyway, so the ABI is 32-bit (did you find the build log I linked to?).
Ah, the link was a buildlog? Right, it does say
| Using ABI 32.
Let me try that then (currently building in 64-bit mode). I know there are more compiler bugs (especially in clang) for 32-bit mode than for 64-bit mode.
Well, the build of gcc-6.2 itself failed with a segfault during stage2:
/var/tmp/portage/sys-devel/gcc-6.2.0-r1/work/gcc-6.2.0/gcc/tree-ssa-loop-niter.c: In function ¡void estimate_numbers_of_iterations()¢: /var/tmp/portage/sys-devel/gcc-6.2.0-r1/work/gcc-6.2.0/gcc/tree-ssa-loop-niter.c:3914:1: internal compiler error: Segmentation fault estimate_numbers_of_iterations (void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please submit a full bug report, with preprocessed source if appropriate. See https://bugs.gentoo.org/ for instructions. Makefile:1087: recipe for target 'tree-ssa-loop-niter.o' failed
So I think we can simply declare gcc6 not ready for production use...
With some "handpåläggning" I managed to build exactly the SVN snapshot of gcc 6.3-pre that was supposed to exhibit the problem (r241817). However, Pike 8.0 (ad9b4ef) builds fine, and passes make verify as well. The plot thickens... I guess I'll try specifying your exact list of configure options next.
Nope, added
--with-cdebug --with-copt --without-rtldebug --with-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' --with-cppflags='-Wdate-time -D_FORTIFY_SOURCE=2 -DDEBIAN' --with-ldflags='-Wl,-z,relro -Wl,--as-needed' --with-bignums --with-gmp --with-poll --with-zlib --with-freetype --without-ttflib --with-libnettle --without-sybase --without-java --with-odbc --with-sane --with-postgres --without-ffmpeg --without-fftw --without-libpdf --without-libpanda --without-GTK --with-GTK2 --without-bundles --without-oracle --without-dvb --with-sqlite --disable-rpath --disable-smartlink_binary --with-machine-code
(phew) to the configure options, but Pike still refuses to crash. I couldn't add the -specs=/usr/share/dpkg/pie-compile.specs stuff because I don't have that file...
You don't have a Debian environment where you can build exactly the same package? There are a *lot* of patches (though many are ada or java specific).
http://sources.debian.net/src/gcc-6/6.2.0-11/debian/patches/
http://sources.debian.net/src/gcc-6/6.2.0-11/debian/patches/
I tried to apply those patches, but it ended in massive failure. Presumably there is a very specific order you need to apply them in, which is not the order you present them in here...
quilt is used to apply patches, but the series file is dynamically built by http://sources.debian.net/src/gcc-6/6.2.0-11/debian/rules.patch, which is included by the normal debian/rules file (see http://sources.debian.net/src/gcc-6/6.2.0-11/debian/README.source). Also, the patches include the diff against the gcc 6.2.0.
This seems very convoluted. Is there a live image of Debian with the exact gcc version so I can at least try it out in a VM?
I don't think so, no official one at least. I think you'll have to download Debian 8.5 installation CD and then upgrade to stretch/sid.
ftp://ftp.se.debian.org/cdimage/archive/8.5.0/powerpc/iso-cd/debian-8.5.0-powerpc-netinst.iso ftp://ftp.se.debian.org/cdimage/archive/8.5.0/powerpc/
I tried something slightly different: I asked an x86 Debian machine at work to cross-compile the gcc package for powerpc. It didn't have any crosstools installed, so the compilation failed, but it did apply the patches to the source tree so that I could copy it over to my PPC machine.
I then ran configure with the same operations as the Debian build (except different prefix and disabling all languages except C and C++) and then make, but yet again GCC fails at building itself. Crash during stage2 again:
/biggus/gcc-6-debian/build/./prev-gcc/xg++ -B/biggus/gcc-6-debian/build/./prev-gcc/ -B/opt/gcc6/powerpc-linux-gnu/bin/ -nostdinc++ -B/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libatomic/.libs -B/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libstdc++-v3/src/.libs -B/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libstdc++-v3/libsupc++/.libs -I/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libstdc++-v3/include/powerpc-linux-gnu -I/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libstdc++-v3/include -I/biggus/gcc-6-debian/src/libstdc++-v3/libsupc++ -L/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libatomic/.libs -L/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libstdc++-v3/src/.libs -L/biggus/gcc-6-debian/build/prev-powerpc-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c -DIN_GCC_FRONTEND -g -O2 -gtoggle -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -Icp -I/biggus/gcc-6-debian/build/../src/gcc -I/biggus/gcc-6-debian/build/../src/gcc/cp -I/biggus/gcc-6-debian/build/../src/gcc/../include -I/biggus/gcc-6-debian/build/../src/gcc/../libcpp/include -I/biggus/gcc-6-debian/build/../src/gcc/../libdecnumber -I/biggus/gcc-6-debian/build/../src/gcc/../libdecnumber/dpd -I../libdecnumber -I/biggus/gcc-6-debian/build/../src/gcc/../libbacktrace -o cp/cp-objcp-common.o -MT cp/cp-objcp-common.o -MMD -MP -MF cp/.deps/cp-objcp-common.TPo /biggus/gcc-6-debian/build/../src/gcc/cp/cp-objcp-common.c /biggus/gcc-6-debian/build/../src/gcc/cp/cp-objcp-common.c: In function ¡void init_shadowed_var_for_decl()¢: /biggus/gcc-6-debian/build/../src/gcc/cp/cp-objcp-common.c:202:1: internal compiler error: Segmentation fault init_shadowed_var_for_decl (void) ^~~~~~~~~~~~~~~~~~~~~~~~~~ 0x10c39317 crash_signal /biggus/gcc-6-debian/build/../src/gcc/toplev.c:333 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See file:///usr/share/doc/gcc-6/README.Bugs for instructions. Makefile:1088: recipe for target 'cp/cp-objcp-common.o' failed make[3]: *** [cp/cp-objcp-common.o] Error 1 make[3]: *** Waiting for unfinished jobs....
With another application of "handpåläggning", I completed a build of the Debian-patched gcc 6.3 snapshot. However, even with this I am not able to reproduce the post-modules build failure...
I noticed that Debian package builds of both 7.8(.866-7) and 8.0(.358-1) have recently started failing on the powerpc architecture.
https://buildd.debian.org/status/fetch.php?pkg=pike8.0&arch=powerpc&...
/«PKGBUILDDIR»/build/linux-3.16.0-4-powerpc64-ppc/pike -DNOT_INSTALLED -DPRECOMPILED_SEARCH_MORE -m/«PKGBUILDDIR»/build/linux-3.16.0-4-powerpc64-ppc/master.pike /«PKGBUILDDIR»/src/post_modules/GL/gen.pike /«PKGBUILDDIR»/src/post_modules/GL/auto.c.in > auto.c.tmp Segmentation fault
This doesn't happen when pike is compiled with -O0, and 7.8.866-6 built fine (the only difference is that -7 is built with MariaDB libraries instead of MySQL), so I assume a compiler bug, but perhaps someone can help figuring out what's triggering it. The backtrace is perhaps not terribly helpful (from 8.0.358):
(gdb) bt full #0 jump_opcode_F_MARK_CALL_LFUN_AND_POP (arg1=272) at /home/zino/hack/pike8-rel/pike/src/interpret_functions.h:2418 addr = <optimized out> jumpaddr = <optimized out>
F_MARK_CALL_LFUN_AND_POP is an OPCODE1_JUMP-opcode, and it looks like neither the ppc32- nor the ppc64-codegenerator uses OPCODE_RETURN_JUMPADDR, so the problem is likely that gcc has implicitly dropped the frame pointer for the function.
pike-devel@lists.lysator.liu.se