home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!odin.scs.uiuc.edu!evensky
- From: evensky@odin.scs.uiuc.edu (David A. Evensky)
- Subject: recursion, array returning subroutine, dump core on SGI
- Message-ID: <C0HKnp.33w@news.cso.uiuc.edu>
- Summary: perl-4.035 fails where perl-4.019 worked on test provided.
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: School of Chemical Sciences Univ. of Illinois, Urbana IL
- Distribution: na
- Date: Thu, 7 Jan 1993 13:40:36 GMT
- Keywords: sgi iris coredump
- Lines: 55
-
-
- Help! I have a recursive program that used to work on patch level 19
- running on an SGI 4D/35G Irix 4.0.5 (currently the 3.10 compilers but
- this problem was noticed before Irix 4.0 was released) The program was
- compiled using the defaults, for the most part. A test case that also
- suffers from the same difficulties is:
-
- #!/usr/bin/perl -P
- #undef KLUDGEFIX
- $|=1;
- $x = 10;
- print ":$x! = ",&factorial($x),"\n";
- sub factorial {
- local($num) = @_;
- print "$num ";
- if ($num > 1) {
- #ifdef KLUDGEFIX
- @myarray = &badcall($num);
- ($a,$b,$c,$d) = @myarray;
- #else
- ($a,$b,$c,$d) = &badcall($num);
- #endif
- $num * &factorial($num - 1);
- } else {
- 1;
- }
- }
- sub badcall { (1,2,3,4); }
-
- odin> perl -v
-
- This is perl, version 4.0
-
- $RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
- Patch level: 19
-
- that produced the following output:
- odin> testprog
- 10 9 8 7 6 5 4 3 2 1 :10! = 3628800
-
- However, under patch level 35:
- odin> ./perl -v
-
- This is perl, version 4.0
-
- $RCSfile: perl.c,v $$Revision: 4.0.1.7 $$Date: 92/06/08 14:50:39 $
- Patch level: 35
-
- that dumps core with:
- odin> testprog
- 10 Segmentation fault (core dumped)
-
- (define'ing KLUDGEFIX will restore the old behavor.)
- Thanks
- \dae
-