On Friday 14 November 2008 18:13:48 Will Coleda via RT wrote:

> Here's a very simple patch:
>
> Index: imcc.l
> =========================================================
> ==========
> --- imcc.l      (revision 32647)
> +++ imcc.l      (working copy)
> @@ -305,7 +305,12 @@
>
>
>  <*>[ISNP]{DIGIT}{DIGIT}? {
> -        valp->s = str_dup(yytext);
> +        if (valp) (valp)->s = str_dup(yytext);
> +
> +        if (! IMCC_INFO(interp)->state->pasm_file)
> +                IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
> +                    "'%s' is only a valid register name in pasm mode",
> yytext); +
>          return REG;
>      }

Move the condition before the str_dup, or you'll create a memory leak in case 
we can recover from IMCC_fataly.

> This works in plain PIR, but causes a misparse in a macro:
>
> error:imcc:'I10' is only a valid register name in pasm mode
>         in file 'runtime/parrot/library/Digest/MD5.pir' line 157
>
>
> Except that the only I10 near that line is $I10.
>
> Thoughts?

I can believe that this is a problem for other types of errors in macros, so 
that may be a separate issue.

-- c

Reply via email to