Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] x86: Fix math.floor()/ceil() argument check.
Date: Tue, 24 Nov 2026 13:20:29 +0300	[thread overview]
Message-ID: <4f2340ab-0c21-4070-b257-7deb4d7f3a07@tarantool.org> (raw)
In-Reply-To: <awVFTCH1wFGBYhY7@root>

Hi, Sergey,

Thanks for the fix. LGTM

On 11/24/26 11:05, Sergey Kaplun wrote:
> Hi, Sergey!
> Thanks for the review!
> See my answers below.
>
> Branch is force-pushed.
>
> On 23.11.26, Sergey Bronnikov wrote:
>> Hi, Sergey!
>>
>> thanks for the patch! LGTM with minor comments.
>>
>> Sergey
>>
>> On 11/23/26 13:46, Sergey Kaplun wrote:
> <snipped>
>
>>> diff --git a/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua b/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua
>>> new file mode 100644
>>> index 00000000..b9def637
>>> --- /dev/null
>>> +++ b/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua
>>> @@ -0,0 +1,36 @@
>>> +local tap = require('tap')
>>> +
>>> +-- Test file to demonstrate LuaJIT incorrect handling of no
>>> +-- arguments for `math.ceil()`, `math.floor()` functions.
>>> +-- See also:https://github.com/LuaJIT/LuaJIT/issues/1532.
>>> +
>>> +local test = tap.test('lj-1532-math-floor-ceil-argcheck')
>>> +
>>> +test:plan(2)
>>> +
>>> +-- A simple function to push a number value for `math.floor()`,
>>> +-- `math.ceil()` to the Lua stack.
>> In fact, a function can push a value for any function, not only
>> `math.floor()` or `math.ceil()`.
>>
>> I would omit the comment at all.
> I've just exmplained here that function must to push some value to the
> stack to be used later as the dirty value for the aforementioned
> functions. The comment about functions explains the returned value.
>
>>> +local function stack()
>>> +  return 1.2
>>> +end
>>> +
>>> +local function call_wp(f)
>>> +  stack() -- Push some value to the stack to mark the slot.
>> nit: we usually put a comments before the line, isn't it?
> Moved:
>
> ===================================================================
> diff --git a/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua b/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua
> index b9def637..a2a2fb80 100644
> --- a/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua
> +++ b/test/tarantool-tests/lj-1532-math-floor-ceil-argcheck.test.lua
> @@ -15,7 +15,8 @@ local function stack()
>   end
>   
>   local function call_wp(f)
> -  stack() -- Push some value to the stack to mark the slot.
> +  -- Push some value to the stack to mark the slot.
> +  stack()
>     -- Use non-inlined variant for function name in the error
>     -- message.
>     local res = f()
> ===================================================================
>
>>> +  -- Use non-inlined variant for function name in the error
>>> +  -- message.
>>> +  local res = f()
>>> +  return res
>>> +end
>>> +
>>> +local function math_func_test(subtest, f)
>>> +  subtest:plan(2)
>>> +  local err, msg = pcall(call_wp, f)
>>> +  subtest:is(err, false, 'correct status for empty ' .. subtest.name)
>>> +  subtest:like(msg, "bad argument #1 to 'f' %(number expected, got no value%)",
>>> +               'correct error message for empty ' .. subtest.name)
>>> +end
>>> +
>>> +test:test('math.ceil', math_func_test, math.ceil)
>>> +test:test('math.floor', math_func_test, math.floor)
>>> +
>>> +test:done(true)

  reply	other threads:[~2026-11-24 10:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:45 [Tarantool-patches] [PATCH luajit 0/2] " Sergey Kaplun via Tarantool-patches
2026-11-23 10:46 ` [Tarantool-patches] [PATCH luajit 1/2] x86: " Sergey Kaplun via Tarantool-patches
2026-11-23 14:51   ` Sergey Bronnikov via Tarantool-patches
2026-11-24  8:05     ` Sergey Kaplun via Tarantool-patches
2026-11-24 10:20       ` Sergey Bronnikov via Tarantool-patches [this message]
2026-11-24 15:56       ` Evgeniy Temirgaleev via Tarantool-patches
2026-11-23 10:46 ` [Tarantool-patches] [PATCH luajit 2/2] x64: " Sergey Kaplun via Tarantool-patches
2026-11-23 14:58   ` Sergey Bronnikov via Tarantool-patches
2026-11-24 15:56   ` Evgeniy Temirgaleev via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f2340ab-0c21-4070-b257-7deb4d7f3a07@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/2] x86: Fix math.floor()/ceil() argument check.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox