blob: 20c0b1123f4721d329fd470f797ecec330cb4768 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= <benoit.burnichon@airtag.com>
Date: Tue, 6 Dec 2011 14:25:18 +0100
Subject: [PATCH] Wrong code generation for some particular boolean
expressions.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Comes from http://www.lua.org/bugs.html#5.1.4-9
reported by Thierry Van Elsuwe on 20 Jan 2011.
Example:
--
print((('hi' or true) and true) or true)
--> hi (should be true)
print(((nil and nil) or false) and true)
--> nil (should be false)
--
Signed-off-by: Benoît Burnichon <benoit.burnichon@airtag.com>
---
src/lcode.c | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/src/lcode.c b/src/lcode.c
index 84f286b..c13066e 100644
--- a/src/lcode.c
+++ b/src/lcode.c
@@ -549,13 +549,6 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
pc = e->u.s.info;
break;
}
- case VFALSE: {
- if (!hasjumps(e)) {
- pc = luaK_jump(fs); /* always jump */
- break;
- }
- /* else go through */
- }
default: {
pc = jumponcond(fs, e, 0);
break;
@@ -579,13 +572,6 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
pc = e->u.s.info;
break;
}
- case VTRUE: {
- if (!hasjumps(e)) {
- pc = luaK_jump(fs); /* always jump */
- break;
- }
- /* else go through */
- }
default: {
pc = jumponcond(fs, e, 1);
break;
|