This patch should fix the problem.
Note that one needs to run flex so as to generate the dependant file
that is tracked by svn.

cd compilers/imcc
flex -d  -o imclexer.c imcc.l


Index: compilers/imcc/imcc.l
===================================================================
--- compilers/imcc/imcc.l       (revision 26966)
+++ compilers/imcc/imcc.l       (working copy)
@@ -629,25 +629,36 @@

 <emit,INITIAL>\$I[0-9]+ {
         if (valp) (valp)->s = yytext;
+       if (IMCC_INFO(interp)->state->pasm_file)
+               REJECT;
         return IREG;
     }

 <emit,INITIAL>\$N[0-9]+ {
         if (valp) (valp)->s = yytext;
+       if (IMCC_INFO(interp)->state->pasm_file)
+               REJECT;
         return NREG;
     }

 <emit,INITIAL>\$S[0-9]+ {
         if (valp) (valp)->s = yytext;
+       if (IMCC_INFO(interp)->state->pasm_file)
+               REJECT;
         return SREG;
     }

 <emit,INITIAL>\$P[0-9]+ {
         if (valp) (valp)->s = yytext;
+       if (IMCC_INFO(interp)->state->pasm_file)
+               REJECT;
         return PREG;
     }

 <emit,INITIAL>\$[a-zA-Z0-9]+ {
+       if (!IMCC_INFO(interp)->state->pasm_file)
+                IMCC_fataly(interp, E_SyntaxError,
+                    "'%s' is not a valid identifier or register name
in pir mode", yytext);
         IMCC_fataly(interp, E_SyntaxError,
             "'%s' is not a valid register name", yytext);
     }


On Apr 14, 10:22 am, [EMAIL PROTECTED] (Klaas-Jan Stol) wrote:
> On Mon, Apr 14, 2008 at 12:26 AM, via RT Bob Rogers
>
>
> <[EMAIL PROTECTED]> wrote:
> > # New Ticket Created by  Bob Rogers
> >  # Please include the string:  [perl #52858]
> >  # in the subject line of all future correspondence about this issue.
> >  # <URL:http://rt.perl.org/rt3/Ticket/Display.html?id=52858>
>
> >    If you run the following PASM code:
>
> >         new P0, 'Integer'
> >         set P0, 77
> >         set $N1, 1
> >         set $N2, 2
> >         set $N3, 3
> >         print $N1
> >         print ' '
> >         print $N2
> >         print ' '
> >         print $N3
> >         print "\n"
> >         print P0
> >         print "\n"
> >         end
>
> >  you will see something like the following output:
>
> >         [EMAIL PROTECTED]> ./parrot dollar-vars.pasm
> >         3.000000 3.000000 3.000000
> >         Segmentation fault
> >         [EMAIL PROTECTED]>
>
> >  The reason for this odd behavior is that all of the $N registers are
> >  getting mapped to "N-1" (that's the register *before* N0); disassembly
> >  shows the bogus register numbers clearly.  This happens to overwrite P0,
> >  hence the segfault.
>
> >    So either the "$" syntax for registers must be disabled in PASM, or
> >  it must be implemented properly.  (I don't particularly care, and
> >  haven't the IMCC-fu to do anything about it myself.)
>
> >                                         -- Bob Rogers
> >                                            http://rgrjr.dyndns.org/
>
> IMCC's lexer has a number of states, one of which is "emit". I'm not
> clear on how all these states are interacting,and to what cases these
> states correspond, but I think "emit" is "pasm" mode (I might be wrong
> here! I never really figured out what all states in IMCC are). The
> lexer recognizes virtual registers (with the $) in this "emit" state
> too.
>
> Ideally, the lexer could be tweaked that when reading $P0 in pasm
> mode, it emits an error message saying you can't use virtual registers
> in pasm mode. Rewriting the lexer rules (and states) might be tricky,
> but a simple solution would to check whether the lexer is in pasm mode
> in the action body of the rule for registers. (I think there's a flag
> in IMCC_INFO).
>
> I don't have time currently to work on this, unfortunately
>
> kjs

Reply via email to