[前][次][番号順一覧][スレッド一覧][生データ]

yarv-dev-en:64

From: Ilmari Heikkinen <kig misfiring.net>
Date: Thu, 23 Feb 2006 05:32:23 +0200
Subject: [yarv-dev-en:64] Re: YARV 0.3.3 bug report

Hi,

On Wed, 2006-02-22 at 20:09 +0200, Ilmari Heikkinen wrote:
> On Wed, 2006-02-22 at 18:48 +0100, Christian Neukirchen wrote:

> > #843<4|>lilith:~/src/yarv$ ./miniruby -ve 'for d,*f in [[1,2,3]]; p d,f; end'
> > ruby 2.0.0 (Base: Ruby 1.9.0 2006-02-14) [powerpc-darwin7.9.0]
> > YARVCore 0.4.0 Rev: 470 (2006-02-22) [opts: ]
> > 1
> > [2, 3]
> > 
> > Darwin lilith 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC  Power Macintosh powerpc
> > gcc version 3.3 20030304 (Apple Computer, Inc. build 1666)
> > bison (GNU Bison) 2.0
> > 
> > Now it becomes fun, eh?
> 
> Indeed.
> Tried on my Pentium III-M laptop:
> 
> [kig jugend:~/downloads/yarv-0.4.0] ./miniruby -ve 'for d,*f in [[1,2,3]]; p d,f; end'
> ruby 2.0.0 (Base: Ruby 1.9.0 2006-02-14) [i686-linux]
> YARVCore 0.4.0 Rev: 466 (2006-02-22) [opts: ]
> 1
> [2, 3]
> 
> CPU: Intel Pentium III (Coppermine) stepping 0a
>
> But on the Athlon desktop it doesn't work...
> 
> $ ./miniruby -ve 'for d,*f in [[1,2,3]]; p d,f; end'
> ruby 2.0.0 (Base: Ruby 1.9.0 2006-02-14) [i686-linux]
> YARVCore 0.4.0 Rev: 470 (2006-02-22) [opts: ]
> 1
> nil
> 
> CPU: AMD Athlon(TM) XP 2100+ stepping 02



I think I found the reason (or a workaround that may break something
else, I'm not too familiar with the yarv internals):

compile.c:set_block_local_tbl:1010
  if ((long)massign->nd_args > 0) {

I added printf("%ld\n", massign->nd_args); above that, and on Pentium 3
it gives a positive number when doing 

ruby -e 'lambda{|*a|}'

but on athlon and p4 it gives a negative number


Changing the line to:
  if (massign->nd_args > 0 && (long)massign->nd_args != -1) {

makes it work correctly:
(
 lambda{|a,b,c,d|} makes massign->nd_args 0, 
 lambda{|a,b,c,*d|} makes  massign->nd_args > 0, 
 lambda{|*|} makes (long)massign->nd_args -1
)
on p3 & athlon & p4.


But I'm not sure if this is the correct solution

-Ilmari


-- 
ML: yarv-dev-en quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]

        38 2006-02-18 12:33 [kig misfiring.net   ] YARV 0.3.3 bug report                   
        42 2006-02-20 16:28 ┗[ko1 atdot.net       ]                                       
        46 2006-02-21 02:22  ┣[ko1 atdot.net       ]                                     
        51 2006-02-22 15:26  ┗[kig misfiring.net   ]                                     
        53 2006-02-22 18:28   ┗[ko1 atdot.net       ]                                   
        54 2006-02-23 00:58    ┗[kig misfiring.net   ]                                 
        57 2006-02-23 01:41     ┗[ko1 atdot.net       ]                               
        58 2006-02-23 01:50      ┗[kig misfiring.net   ]                             
        60 2006-02-23 02:26       ┗[ko1 atdot.net       ]                           
        61 2006-02-23 02:48        ┗[chneukirchen gmail.c]                         
        62 2006-02-23 03:09         ┗[kig misfiring.net   ]                       
        63 2006-02-23 04:26          ┣[kig misfiring.net   ]                     
->      64 2006-02-23 12:32          ┗[kig misfiring.net   ]                     
        68 2006-02-24 07:19           ┗[ko1 atdot.net       ]                   
        83 2006-02-27 22:24            ┗[ko1 atdot.net       ]