Skip to content

Wrong result of multi-assignment #440

@AlexanderYastrebov

Description

@AlexanderYastrebov

You must post issues only here. Questions, ideas must be posted in discussions.

  • GopherLua is a Lua5.1 implementation. You should be familiar with Lua programming language. Have you read Lua 5.1 reference manual carefully?
  • GopherLua is a Lua5.1 implementation. In Lua, to keep it simple, it is more important to remove functionalities rather than to add functionalities unlike other languages . If you are going to introduce some new cool functionalities into the GopherLua code base and the functionalities can be implemented by existing APIs, It should be implemented as a library.

Please answer the following before submitting your issue:

  1. What version of GopherLua are you using? : 2b3f02d
  2. What version of Go are you using? : go version go1.20.4 linux/amd64
  3. What operating system and processor architecture are you using? : -
  4. What did you do? :
-- x.lua
local a, b = 0, 0
a, b = a + 1, a + b
print(a, b)
$ lua -v
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
$ lua x.lua 
1       0
$ git describe --tags
v1.1.0-11-g2b3f02d
$ make glua
$ ./glua x.lua 
1       1
  1. What did you expect to see? :
1       0
  1. What did you see instead? :
1       1

This looks related to #355 and #315.

Discovered while debugging test suite for https://github.com/Egor-Skriptunoff/pure_lua_SHA

$ glua sha2_test.lua 
./sha2.lua:87: at least 53-bit floating point numbers are required
stack traceback:
        [G]: in function 'assert'
        ./sha2.lua:87: in function <./sha2.lua:0>
        [G]: in function 'require'
        sha2_test.lua:5: in main chunk
        [G]: ?

which fails due to incorrect multi-assignment calculation here https://github.com/Egor-Skriptunoff/pure_lua_SHA/blob/6adac177c16c3496899f69d220dfb20bc31c03df/sha2.lua#L75

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions