Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Next zsh release



On 19 May 2011 20:17, Wayne Davison <wayne@xxxxxxxxxxxxxxx> wrote:
> On Thu, May 19, 2011 at 10:53 AM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> Hm, in this line,
>> push(setmathvar(mvp,c), mvp->lval, 0);
>> isn't it undefined whether setmathvar runs first or mvp->lval is evaluated?
>
> Yeah, it is.  That should probably be changed to this, just for safety's sake:
>
>            c = setmathvar(mvp, c);
>            push(c, mvp->lval, 0);

make check still passes with this change, other than that I'm not sure
exactly what math construct this code actually handles. It fails if I
comment out the push() though, so it's covered I
suppose.</superparanoidmode>

--- a/Src/math.c
+++ b/Src/math.c
@@ -1161,7 +1161,8 @@ op(int what)
        }
        if (tp & (OP_E2|OP_E2IO)) {
            struct mathvalue *mvp = stack + sp + 1;
-           push(setmathvar(mvp,c), mvp->lval, 0);
+           c = setmathvar(mvp, c);
+           push(c, mvp->lval, 0);
        } else
            push(c,NULL, 0);
        return;


-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author