home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7698 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.8 KB  |  69 lines

  1. Newsgroups: comp.lang.perl
  2. 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
  3. From: evensky@odin.scs.uiuc.edu (David A. Evensky)
  4. Subject: recursion, array returning subroutine, dump core on SGI
  5. Message-ID: <C0HKnp.33w@news.cso.uiuc.edu>
  6. Summary: perl-4.035 fails where perl-4.019 worked on test provided.
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Organization: School of Chemical Sciences Univ. of Illinois, Urbana IL
  9. Distribution: na
  10. Date: Thu, 7 Jan 1993 13:40:36 GMT
  11. Keywords: sgi iris coredump
  12. Lines: 55
  13.  
  14.  
  15. Help! I have a recursive program that used to work on patch level 19
  16. running on an SGI 4D/35G Irix 4.0.5 (currently the 3.10 compilers but
  17. this problem was noticed before Irix 4.0 was released) The program was
  18. compiled using the defaults, for the most part. A test case that also
  19. suffers from the same difficulties is:
  20.  
  21.   #!/usr/bin/perl -P
  22.   #undef  KLUDGEFIX
  23.   $|=1;
  24.   $x = 10;
  25.   print ":$x! = ",&factorial($x),"\n";
  26.   sub factorial {
  27.      local($num) = @_;
  28.      print "$num ";
  29.      if ($num > 1) {
  30.   #ifdef KLUDGEFIX
  31.     @myarray = &badcall($num);
  32.     ($a,$b,$c,$d) = @myarray;
  33.   #else
  34.     ($a,$b,$c,$d) = &badcall($num);
  35.   #endif
  36.     $num * &factorial($num - 1);
  37.      } else {
  38.     1;
  39.      }
  40.   }
  41.   sub badcall { (1,2,3,4); }
  42.  
  43. odin> perl -v
  44.  
  45. This is perl, version 4.0
  46.  
  47. $RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
  48. Patch level: 19
  49.  
  50. that produced the following output:
  51. odin> testprog
  52. 10 9 8 7 6 5 4 3 2 1 :10! = 3628800
  53.  
  54. However, under patch level 35:
  55. odin> ./perl -v
  56.  
  57. This is perl, version 4.0
  58.  
  59. $RCSfile: perl.c,v $$Revision: 4.0.1.7 $$Date: 92/06/08 14:50:39 $
  60. Patch level: 35
  61.  
  62. that dumps core with:
  63. odin> testprog
  64. 10 Segmentation fault (core dumped)
  65.  
  66. (define'ing KLUDGEFIX will restore the old behavor.)
  67. Thanks
  68. \dae
  69.