[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug in error message for table.concat
- From: Gavin Wraith <gavin@...>
- Date: Mon, 15 Feb 2021 10:23:27 GMT
In message <8735xyqlp8.fsf@news-spur.riddles.org.uk>
Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
>The addfield() subroutine of table.concat is (in 5.3.x and 5.4.x):
>
>static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) {
> lua_geti(L, 1, i);
> if (!lua_isstring(L, -1))
> luaL_error(L, "invalid value (%s) at index %d in table for 'concat'",
> luaL_typename(L, -1), i);
> luaL_addvalue(b);
>}
>
>But this error message is wrong, because %d expects an "int" value, not
>a lua_Integer.
>
>This shows up most clearly on 32-bit ARM (which is what the IRC user who
>reported it was using); under the rules for that platform, a 64-bit int
>as the 4th arg after 3 pointers ends up on the stack, because register
>alignment rules prevent it going into r3; but pushvfstring is looking
>for it in the place where r3 would have been stored since it thinks it
>is only 32 bits. So on that platform I get, for example:
>
>> table.concat({{}, {}}, ',')
>stdin:1: invalid value (table) at index 539390232 in table for 'concat'
I get this error too, with Lua 5.4.2 using 64-bit numbers on a Raspberry Pi3B+
under RISC OS.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/