Bug 141694 - (IT_54408) compiler optimization causes build failure with perl-5.8.5-12
compiler optimization causes build failure with perl-5.8.5-12
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
3.0
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-02 18:25 EST by David Lehman
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-18 09:42:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Backported PR rtl-optimization/14279 fix that seems to fix this. (1.31 KB, patch)
2004-12-22 06:21 EST, Jakub Jelinek
no flags Details | Diff

  None (edit)
Description David Lehman 2004-12-02 18:25:40 EST
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) ;;
"
Comment 3 Jakub Jelinek 2004-12-22 04:40:44 EST
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...
Comment 4 Jakub Jelinek 2004-12-22 05:37:00 EST
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);
}
Comment 5 Jakub Jelinek 2004-12-22 06:21:18 EST
Created attachment 108995 [details]
Backported PR rtl-optimization/14279 fix that seems to fix this.
Comment 7 Jakub Jelinek 2005-01-04 12:55:51 EST
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/
Comment 8 Tim Powers 2005-05-18 09:42:35 EDT
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

Note You need to log in before you can comment on or make changes to this bug.