From 843c2d67d927797bc3af059e815b946b0ade58f3 Mon Sep 17 00:00:00 2001 From: Piotr Likoski Date: Fri, 12 Jul 2019 14:36:56 +0200 Subject: [PATCH] I am pretty sure we want to use the number of elements in array in this place, not the actual size of array. The size of a structure is greater than the sum of its parts because of what is called packing. A particular processor has a preferred data size that it works with. Most modern processors' preferred size if 32-bits (4 bytes). --- engine/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/parser.c b/engine/parser.c index c73c9bb..179c79e 100644 --- a/engine/parser.c +++ b/engine/parser.c @@ -238,7 +238,7 @@ static sxi32 ExprVerifyNodes(ph7_gen_state *pGen, ph7_expr_node **apNode, sxi32 apNode[i]->pStart->nType &= ~PH7_TK_OCB /*'{'*/; apNode[i]->pStart->nType |= PH7_TK_OSB /*'['*/; pOp = aOpTable; - pEnd = &pOp[sizeof(aOpTable)]; + pEnd = &pOp[sizeof(aOpTable) / sizeof(ph7_expr_op)]; while(pOp < pEnd) { if(pOp->iOp == EXPR_OP_SUBSCRIPT) { break;