lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Subject: Re: Bug with logical operator or misunderstanding?
Reply-To: dslate@speakeasy.net
To: lua-l@lists.lua.org

Just wondering when the Lua (and LuaJIT) developers will address this
boolean expression evaluation error issue.  Lua's a great language,
and I'm happily using LuaJIT-2.0.0-beta5 with beta5_hotfix1.patch.txt
as a drop-in replacement for Lua-5.1.4, but the fact that this error
occurs in such a syntactically and semantically simple expression
makes one wonder what other evaluation bugs may be lurking in what are
otherwise very reliable tools.

One would hope that fixing this bug would be a priority for finishing
up Lua-5.2 and LuaJIT-2.0.

Thanks,

-- Dave Slate


On Thu, 20 Jan 2011 16:27:41 -0500 Leo Razoumov <slonik.az@gmail.com> wrote:

> On Thu, Jan 20, 2011 at 11:11, Philipp Janda <siffiejoe@gmx.net> wrote:
> > Am 20.01.2011 16:45, schrieb Michal Kottman:
> >>
> >> I guess this is a known bug - http://www.lua.org/bugs.html#5.1.4-3 .
> >>
> >
> > Probably, but the given patch does not work for this case.
> >
> > Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> >> print(((1 or false) and true) or false)
> > true
> >> print( (1 or 2) and true or false )
> > 1
> >> print(((1 or true) and true) or false)
> > 1
> >>
> >
> > First test is from the bugs page and works correctly with the given
> > patch, second (and third) test is still wrong.
> >
> > Philipp
> >
> 
> Confirmed. My Lua-5.1.4 is fully patched with
> http://www.lua.org/ftp/patch-lua-5.1.4-2
> and on Linux x86 (32 bits) I  get:
> 
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > print(((1 or false) and true) or false)
> true   -- correct
> > print(((1 or 2) and true) or false)
> 1   -- WRONG
> >
> 
> Seems that the patch http://www.lua.org/bugs.html#5.1.4-3  has not
> fixed the problem entirely.
> 
> --Leo--