http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52383
Bug #: 52383 Summary: gcc-4.6 regression: miscompiles Perl on m68k Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: regression AssignedTo: unassig...@gcc.gnu.org ReportedBy: t...@mirbsd.org Created attachment 26753 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26753 gzip’d tarball with preprocessed source and assembler output Hi, this was originally reported as: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658050 The problem is that Perl misbehaves at runtime due to being miscompiled. It is not reproducible without a native m68k system thus. Sorry about that. I’ve tracked the problem down to one file. The failure mode is (“cc” is gcc-4.6): […] cc -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-regmove -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -Wwrite-strings -fPIC -DPERL_IS_MINIPERL -DPERL_EXTERNAL_GLOB perlmini.c LD_LIBRARY_PATH=/tmp/buildd/perl-5.14.2 cc -fstack-protector -L/usr/local/lib -o miniperl gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o keywords.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o miniperlmain.o opmini.o perlmini.o -ldl -lm -lpthread -lc -lcrypt LD_LIBRARY_PATH=/tmp/buildd/perl-5.14.2 ./miniperl -Ilib make_patchnum.pl Failure yields: Out of memory during list extend at make_patchnum.pl line 126. Success yields one of these (the first only once): Updating 'git_version.h' and 'lib/Config_git.pl' Reusing 'git_version.h' and 'lib/Config_git.pl' I’ve attached the results of the following commands: cc -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-regmove -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -Wwrite-strings -fPIC -DPERL_IS_MINIPERL -DPERL_EXTERNAL_GLOB perlmini.c -E -o perlmini.i gcc-4.6 -S -O1 -fPIC perlmini.i -o perlmini.-O1.s gcc-4.6 -S -O2 -fPIC perlmini.i -o perlmini.-O2.s gcc-4.4 -S -O2 -fPIC perlmini.i -o perlmini.4_4.s The following commands (plus linking and running) will fail: gcc-4.6 -c -O2 -fPIC perlmini.i The following commands (plus linking and running) will succeed: gcc-4.6 -c -O1 -fPIC perlmini.i gcc-4.4 -c -O2 -fPIC perlmini.i So this is an optimisation bug (I think) in gcc-4.6 and a regression from gcc-4.4 (the linking command uses gcc-4.6 in all cases as I’ve not changed it). Naturally, these are not easily diff’able. Version information: gcc-4.6 a.k.a. cc is compiled from Debian 4.6.2-15 sources plus the (second) bugfix from PR47612: Using built-in specs. Target: m68k-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.6-14' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --disable-libssp --enable-objc-gc --disable-werror --disable-multilib --enable-checking=release --build=m68k-linux-gnu --host=m68k-linux-gnu --target=m68k-linux-gnu Thread model: posix gcc version 4.4.6 (Debian 4.4.6-14) gcc-4.4 is compiled from unmodified Debian sid sources: Using built-in specs. Target: m68k-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.6-14' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --disable-libssp --enable-objc-gc --disable-werror --disable-multilib --enable-checking=release --build=m68k-linux-gnu --host=m68k-linux-gnu --target=m68k-linux-gnu Thread model: posix gcc version 4.4.6 (Debian 4.4.6-14) If you need me to copy out any more files from this chroot, or tar it up entirely, or run tests; sure, can be done.