openresty / openresty/luajit2

Failed test when running ffi_bit64.lua in v2.1-20200102

Open
#90 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.4k
Forks
252
Avg merge
7d 11h
Merged PRs (30d)
3

Description

Debian 10 Buster x64

# gcc --version
gcc (Debian 8.3.0-6) 8.3.0

On clean system:

git clone https://github.com/openresty/luajit2.git
cd luajit2
git checkout v2.1-20200102
export LUAJIT_PREFIX=/opt/luajit21
export LUAJIT_COMMON_XCFLAGS="-DLUA_USE_APICHECK -DLUA_USE_ASSERT -DLUAJIT_NUMMODE=2 -msse4.2 -O1"
export LUAJIT_XCFLAGS="$LUAJIT_COMMON_XCFLAGS"

make -j `nproc` PREFIX=$LUAJIT_PREFIX XCFLAGS="$LUAJIT_XCFLAGS"
make install PREFIX=$LUAJIT_PREFIX

git clone https://github.com/openresty/luajit2-test-suite.git ../luajit2-test-suite
cd ../luajit2-test-suite
./run-tests -j 4 /opt/luajit21

As a result, I've got:

...
=== test/ffi/ffi_bit64.lua
/opt/luajit21/bin/luajit-2.1.0-beta3: ffi_bit64.lua:18: assertion failed!
stack traceback:
        [C]: in function 'assert'
        ffi_bit64.lua:18: in main chunk
        [C]: at 0x557ea2555190
Failed test when running /opt/luajit21/bin/luajit-2.1.0-beta3 ffi_bit64.lua 1: 256
...

test/ffi/ffi_bit64.lua:18 is:

assert(tostring(band(1ll, 1, 1ull, -1)) == "1ULL")

What's wrong with my setup?
How can I overcome this issue?

Actual result of this snippet:

local bit = require("bit")
local band = bit.band
print(tostring(band(1ll, 1, 1ull, -1)))

is 0ULL

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the listed v2.1-20200102 build flags and the luajit2-test-suite command. Start with test/ffi/ffi_bit64.lua, especially line 18, then compare its expected value with the reported 0ULL result from bit.band. Done means identifying the cause and making this test pass or documenting the confirmed setup limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.