# New Ticket Created by  Matt Diephouse 
# Please include the string:  [perl #39597]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=39597 >


The following code in lines 108-110 of languages/tcl/src/class/ 
tclcommand.pir are giving parrot some trouble:

    inlined.emit("  if epoch != %0 goto dynamic_%1", epoch, label_num)
    inlined .= retval
    inlined.emit("  goto end_%0", label_num)

as evidenced here:

   mini:~/Projects/parrot/languages/tcl mdiep$ cat test.tcl
    puts here
    exit
    puts nothere
   mini:~/Projects/parrot/languages/tcl mdiep$ parrot tcl.pbc test.tcl
   src/string.c:712: failed assertion `s->encoding && s->charset && ! 
PObj_on_free_list_TEST(s)'
   Abort trap
   mini:~/Projects/parrot/languages/tcl mdiep$

Changing those lines to

    $S0 = "  if epoch != %0 goto dynamic_%1"
    inlined.emit($S0, epoch, label_num)
    inlined .= retval
    $S0 = "  goto end_%0"
    inlined.emit($S0, label_num)

makes the code run as expected:

   mini:~/Projects/parrot/languages/tcl mdiep$ parrot tcl.pbc test.tcl
   here
   mini:~/Projects/parrot/languages/tcl mdiep$

Changing just the second .emit line to use an S register:

    inlined.emit("  if epoch != %0 goto dynamic_%1", epoch, label_num)
    inlined .= retval
    $S0 = "  goto end_%0"
    inlined.emit($S0, label_num)

gives a different error:

   mini:~/Projects/parrot/languages/tcl mdiep$ parrot tcl.pbc test.tcl
   error:imcc:syntax error, unexpected '\n', expecting '('
   in file 'EVAL_2' line 39
   mini:~/Projects/parrot/languages/tcl mdiep$

Here, parrot is using the wrong string for the first .emit as shown  
in the trace:

  20366 set_args PC1567 (4), P1, "__read", P2, S3           
PC1567=FixedIntegerArray=PMC(0x2739508) P1=Object(TclCod
   eString)=PMC(0x301140c)  P2=Integer=PMC(0x301442c: 0) S3="3"
    20372 get_results PC1558
    20374 callmethodcc P1, "emit"          P1=Object(TclCodeString) 
=PMC(0x301140c)

Help here would be greatly appreciated.

--
matt diephouse
http://matt.diephouse.com

Reply via email to