On Thursday 03 April 2008 11:22:16 Andy Dougherty wrote:

> First, deep inside IMCC_subst_constants() in compilers/imcc/optimizer.c,
> when the divide by zero fails, it returns a NULL value, but forgets to
> also set the undocumented "return" value for 'ok'.  The appended patch
> sets it to 0, figuring all is not ok if we encountered an exception.
>
> This is a problem because in compilers/imcc/parser_util.c, inside INS(),
> the ok variable is never initialized.  Apparently, on x86, it ends up
> filled with some non-zero value, but on SPARC it ends up as a zero.
> The appended patch initializes the variable.
>
> What to do with the return values, however, is a different question.
> After this patch is applied, the information that an exception occured
> has now correctly propagated up to the INS() function, but it's not
> at all clear to me what to do with it from here.

Agreed.

> diff -r -u parrot-svn/compilers/imcc/optimizer.c
> parrot-andy/compilers/imcc/optimizer.c ---
> parrot-svn/compilers/imcc/optimizer.c 2008-03-31 15:14:39.000000000 -0400
> +++ parrot-andy/compilers/imcc/optimizer.c    2008-04-03 13:14:52.000000000
> -0400 @@ -976,8 +976,10 @@
>       * from the result
>       */
>      branched = eval_ins(interp, op, found, r);
> -    if (branched == -1)
> +    if (branched == -1) {
> +        *ok = 0; /* XXX Is this return value sensible? */
>           return NULL;
> +    }

Sadly, this part doesn't work because of the other call to this function.  
I've applied the rest of the patch with some tweaks as r26763.

-- c

Reply via email to