<HTML><BODY><div class="cl-69kcp9gx5t"><div>Hi, Sergey!</div>Please, consider the idea about marking the tests with special build options.<div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><span>From: Sergey Kaplun <<a href="mailto:skaplun@tarantool.org">skaplun@tarantool.org</a>><br>To: Evgeniy Temirgaleev <<a href="mailto:e.temirgaleev@tarantool.org">e.temirgaleev@tarantool.org</a>><br>Cc: tarantool-patches@dev.tarantool.org, Sergey Bronnikov <<a href="mailto:sergeyb@tarantool.org">sergeyb@tarantool.org</a>><br>Date: Wednesday, July 29, 2026 11:44 AM +03:00</span><br> <div><div id=""><div class="cl-36of2bdmrc"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div id="style_17853146660752376701_mr_css_attr"><div id="style_17853146660752376701_BODY_mr_css_attr">Hi, Evgeniy!<br>Thanks for the review!<br>Please, see my answers below.<br><br>On 28.07.26, Evgeniy Temirgaleev wrote:<br>> Hi, Sergey! Thanks for the patch!<br>><br>> LGTM after updating the test. I tried the test and it passed without the fix.<br><br>You need to build LuaJIT with ASAN support, see the comment below.</div></div></div></div></div></div></blockquote></div></div><div>I thinks it will be better to include such information to the test’s code in a some way.</div><div><div>For example, we can add comments to the code, which we expect to fail with ASAN checks. Also, we can add mark to the corresponding test condition messages with ‘ASAN’ to reflect this in the test reports.</div></div><div class="cl-69kcp9gx5t"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div class="cl-36of2bdmrc"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br><snipped><br><br>The test fails if run under ASAN. Build LuaJIT with its support like the<br>following:<br><br>| cmake -DLUAJIT_ENABLE_GC64=ON -DLUAJIT_USE_SYSMALLOC=ON -DLUAJIT_USE_ASAN=ON -DLUAJIT_USE_UBSAN=ON -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON . && make -j<br><br>But I like the idea to check memory layout of the given structure. See<br>the iterative patch below:<br><br>===================================================================<br>diff --git a/test/tarantool-tests/lj-1451-ffi-packed-bitfield.test.lua b/test/tarantool-tests/lj-1451-ffi-packed-bitfield.test.lua<br>index 07e53f76..76483b0d 100644<br>--- a/test/tarantool-tests/lj-1451-ffi-packed-bitfield.test.lua<br>+++ b/test/tarantool-tests/lj-1451-ffi-packed-bitfield.test.lua<br>@@ -10,13 +10,21 @@ local ffi = require('ffi')<br><br>ffi.cdef[[<br>#pragma pack(push, 2)<br>+<br>typedef struct {<br>unsigned int bitfield:1;<br>} packed_struct;<br>+<br>+typedef struct {<br>+ unsigned int bitfield0:1;<br>+ unsigned int bitfield15:15;<br>+ unsigned int bitfield16:1;<br>+} packed_struct2;<br>+<br>#pragma pack(pop)<br>]]<br><br>-test:plan(2)<br>+test:plan(5)<br><br>local packed = ffi.new('packed_struct')<br><br>@@ -25,4 +33,10 @@ test:is(packed.bitfield, 0, 'correct 0-initialization')</div></div></div></div></div></div></blockquote></div></div><div>test:is(packed.bitfield, 0, 'ASAN: correct 0-initialization') -- ASAN: heap overflow on read</div><div class="cl-69kcp9gx5t"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div class="cl-36of2bdmrc"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div>packed.bitfield = 1</div></div></div></div></div></div></blockquote></div></div><div class="cl-69kcp9gx5t"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div class="cl-36of2bdmrc"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div>test:is(packed.bitfield, 1, 'bitfield set correctly')</div></div></div></div></div></div></blockquote></div></div><div>packed.bitfield = 1 -- ASAN: heap overflow on write</div><div>test:is(packed.bitfield, 1, 'ASAN: bitfield set correctly')</div><div class="cl-69kcp9gx5t"><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><div><div><div class="cl-36of2bdmrc"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div><div><br>+-- Check correct structure layout.<br>+local byteoffset, bitpos, bitsize = ffi.offsetof('packed_struct2', 'bitfield16')<br>+test:is(byteoffset, 2, 'byteoffset is correct')<br>+test:is(bitpos, 0, 'bitpos is correct')<br>+test:is(bitsize, 1, 'bitsize is correct')<br>+<br>test:done(true)<br>===================================================================<br><br>Branch is force-pushed.<br>><br>> --<br>> Best regards,<br>> Evgeniy Temirgaleev<br>><br>> ><br><br><snipped><br><br>> > b/test/tarantool-tests/lj-1451-ffi-packed-bitfield.test.lua<br>> > new file mode 100644<br>> > index 00000000..07e53f76<br>> > --- /dev/null<br>> > +++ b/test/tarantool-tests/lj-1451-ffi-packed-bitfield.test.lua<br>> > @@ -0,0 +1,28 @@<br>> > +local tap = require('tap')<br>> > +<br>> > +-- Test file to demonstrate LuaJIT's incorrect behaviour of the<br>> > +-- `#pragma` pack directive for bitfields in structures.<br>> > +-- See also: <a href="https://github.com/LuaJIT/LuaJIT/issues/1451">https://github.com/LuaJIT/LuaJIT/issues/1451</a>.<br>> > +<br>> > +local test = tap.test('lj-1451-ffi-packed-bitfield')<br>> > +<br>> > +local ffi = require('ffi')<br>> > +<br>> > +ffi.cdef[[<br>> > +#pragma pack(push, 2)<br>> > +typedef struct {<br>> > + unsigned int bitfield:1;<br>> > +} packed_struct;<br>> > +#pragma pack(pop)<br>> > +]]<br>> > +<br>> > +test:plan(2)<br>> > +<br>> > +local packed = ffi.new('packed_struct')<br>> > +<br>> > +test:is(packed.bitfield, 0, 'correct 0-initialization')<br>> > +<br>> > +packed.bitfield = 1<br>> > +test:is(packed.bitfield, 1, 'bitfield set correctly')<br>> > +<br>> > +test:done(true)<br>> > --<br>> > 2.55.0<br>> ><br><br>--<br>Best regards,<br>Sergey Kaplun</div></div></div></div></div></div></blockquote></div></div><div><div>--<br>Best regards,</div><div>Evgeniy Temirgaleev</div></div></BODY></HTML>