Description of problem: In order to get perl-5.8.5 to build on RHEL3-U3 you need to patch it to reduce the optimization to -O1 on three .o files. It it easily reproducible with the perl SRPM from RHEL4-Beta2 on an RHEL3-U3 box. Version-Release number of selected component (if applicable): gcc-3.2.3-42.src.rpm How reproducible: Always on ia64 Steps to Reproduce: 1. rpmbuild --rebuild perl-5.8.5-12.src.rpm 2. 3. Actual results: cc -L/usr/local/lib -o miniperl \ miniperlmain.o opmini.o libperl.a -lnsl -ldl -lm -lcrypt -lutil -lc ./miniperl -w -Ilib -MExporter -e '<?>' || make minitest Attempt to free unreferenced scalar: SV 0x6000000000034ab0. make: [extra.pods] Error 1 (ignored) ./miniperl -Ilib configpm configpm.tmp sh mv-if-diff configpm.tmp lib/Config.pm ./miniperl -Ilib lib/lib_pm.PL Attempt to free unreferenced scalar: SV 0x6000000000034d00 at lib/lib_pm.PL line 1. Attempt to free unreferenced scalar: SV 0x600000000003c7c0 at lib/File/Basename.pm line 138. Attempt to free unreferenced scalar: SV 0x600000000003c7c0 at lib/File/Basename.pm line 142. Attempt to free unreferenced scalar: SV 0x6000000000065680 at lib/warnings.pm line 134. Attempt to free unreferenced scalar: SV 0x600000000003c7f0 at lib/File/Basename.pm line 143. Attempt to free unreferenced scalar: SV 0x6000000000042980 at lib/Exporter/Heavy.pm line 3. make: *** [lib/lib.pm] Segmentation fault Expected results: Successful build Additional info: This is only on ia64 AFAIK (although the patch I found implies it's also true on arm and ppc). I'll attach the patch in case this ends up getting reassigned to perl. I have verified that applying the following patch allows the build to finish successfully. Here are some snippets from a patch from Debian provided by a customer of ours: " + by the people working on #247176 into the package infrastructure. + - on ARM and ia64 set optimize=-O1 for selected files + (63_debian_optim_workaround) " and " --- perl-5.8.4.orig/debian/patches/63_debian_optim_workaround +++ perl-5.8.4/debian/patches/63_debian_optim_workaround @@ -0,0 +1,36 @@ +Work around toolchain breakage on ia64, arm and powerpc - #247176 + +diff -Naur --exclude=debian perl-5.8.4.orig/cflags.SH perl-5.8.4/cflags.SH +--- perl-5.8.4.orig/cflags.SH 2002-09-30 20:59:07.000000000 +1000 ++++ perl-5.8.4/cflags.SH 2004-10-25 01:05:29.000000000 +1000 +@@ -107,8 +107,11 @@ + perlmain) ;; + perly) ;; + pp) ;; +- pp_ctl) ;; +- pp_hot) ;; ++ pp_ctl|pp_hot|pp_sort) ++ case $archname in ++ arm-*|ia64-*|powerpc-*) ++ optimize=-O1;; ++ esac;; + pp_pack) ;; + pp_sys) ;; + regcomp) ;; "
It builds with -O2 -fno-delete-null-pointer-checks for those 3 files, but doesn't with -O2. In pp_hot.c the function that matters seems to be Perl_pp_entersub. Will debug what's going on...
Simplified testcase that works with -O1 -or -O2 -fno-delete-null-pointer-checks, but doesn't with -O2: extern void abort (void); extern void exit (int); struct S { void *a; unsigned int b; }; void __attribute__((noinline)) bar (struct S *x) { if (x->b != 2) abort (); } void __attribute__((noinline)) foo (struct S *x) { if (! x->a) { struct S *y, *z; y = x; if (y) ++y->b; z = x; if (z) ++z->b; bar (x); } } int main (void) { struct S s = { 0, 0 }; foo (&s); exit (0); }
Created attachment 108995 [details] Backported PR rtl-optimization/14279 fix that seems to fix this.
Fix for this has been added to gcc-3.2.3-50, for the time being available from: ftp://people.redhat.com/jakub/gcc/3.2.3-50/
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2005-258.html