[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: code generation bug
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 27 Apr 2009 16:38:06 -0300
> I was surprised to notice the following:
>
> Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > =((1 or false) and true) or false
> 1
>
> [...]
Not surprisingly, the dual case has the same bug:
> = ((nil and true) or false) and true
nil
> f=false
> = ((nil and true) or f) and true
false
> For what it's worth, I observed in lcode.c that the OPR_AND expression
> inherited the 'k' (kind) of VTRUE from its rhs subexpression,
> which seems wrong and seems to throw off the subsequent call to
> luaK_goiffalse().
Well, the result of "((1 or false) and true)" is true, so the inherited
attribute VTRUE is not completely wrong. The problem seems to be the
interaction between this attribute and the patch lists. (But I still need
some time to check this bug...)
-- Roberto