chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #1703: Arguments being passed to procedure incorrectly


From: Chicken Trac
Subject: Re: #1703: Arguments being passed to procedure incorrectly
Date: Fri, 04 Sep 2020 14:28:35 -0000

#1703: Arguments being passed to procedure incorrectly
----------------------------------------+----------------------
            Reporter:  Jakob L. Kreuze  |      Owner:  sjamaan
                Type:  defect           |     Status:  accepted
            Priority:  major            |  Milestone:  5.3
           Component:  compiler         |    Version:  5.2.0
          Resolution:                   |   Keywords:
Estimated difficulty:  hard             |
----------------------------------------+----------------------

Comment (by sjamaan):

 This seems to be a bad interaction between argvector re-use and the rest-
 arg optimization:

 {{{
 static void C_ccall f_147(C_word c,C_word *av){
 C_word tmp;
 C_word t0=av[0];
 C_word t1=av[1];
 C_word t2;
 C_word *a;
 C_check_for_interrupt;
 if(C_unlikely(!C_demand(C_calculate_demand((c-2)*C_SIZEOF_PAIR +0,c,3)))){
 C_save_and_reclaim((void*)f_147,c,av);}
 a=C_alloc((c-2)*C_SIZEOF_PAIR+0);
 t2=C_build_rest(&a,c,2,av);
 C_word t3;
 C_trace(C_text("test.scm:5: reduce"));
 {C_proc tp=(C_proc)C_fast_retrieve_proc(*((C_word*)lf[0]+1));
 C_word *av2;
 if(c >= 4) {
   av2=av;   // Argvector re-use, av = av2
 } else {
   av2=C_alloc(4);
 }
 av2[0]=*((C_word*)lf[0]+1);
 av2[1]=t1;
 av2[2]=t2;
 av2[3]=C_get_rest_arg(c,2,av,2,t0); // <- Picks av[2], which just got set
 in the line above!
 tp(4,av2);}}
 }}}

 I need to figure out how to best deal with this...

-- 
Ticket URL: <https://bugs.call-cc.org/ticket/1703#comment:5>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]