Skip to content

[zig cc] failure to compile php-opcache with jit enabled #24252

@henderkes

Description

@henderkes

Zig Version

0.15-dev

Steps to Reproduce and Observed Behavior

git clone https://github.com/crazywhalecc/static-php-cli
cd static-php-cli
composer install
export CC="zig cc -target x86_64-linux-gnu.2.17"
bin/spc download -e opcache
bin/spc build "opcache" --enable-zts --build-cli --debug

Expected Behavior

Compiles correctly.

Actual behaviour:

ext/opcache/jit/ir/minilua /home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/dynasm.lua  -D X64=1 -o ext/opcache/jit/ir/ir_emit_x86.h /home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/ir_x86.dasc
thread 14509 panic: 4.294967296e9 is outside the range of representable values of type 'int'
ext/opcache/jit/ir/dynasm/minilua.c:1638:1: 0x1052ce2 in luaH_get (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
lua_number2int(k,n);
^
ext/opcache/jit/ir/dynasm/minilua.c:1655:16: 0x1054e60 in luaH_set (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
const TValue*p=luaH_get(t,key);
               ^
ext/opcache/jit/ir/dynasm/minilua.c:3145:12: 0x1096435 in addk (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
TValue*idx=luaH_set(L,fs->h,k);
           ^
ext/opcache/jit/ir/dynasm/minilua.c:3169:8: 0x1096302 in luaK_numberK (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
return addk(fs,&o,&o);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:3334:15: 0x10980ee in luaK_exp2RK (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
(e->k==VKNUM)?luaK_numberK(fs,e->u.nval):
              ^
ext/opcache/jit/ir/dynasm/minilua.c:3528:8: 0x10a40e6 in codecomp (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
int o2=luaK_exp2RK(fs,e2);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:3621:13: 0x108f5bb in luaK_posfix (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
case OPR_GE:codecomp(fs,OP_LE,0,e1,e2);break;
            ^
ext/opcache/jit/ir/dynasm/minilua.c:4293:1: 0x108d91b in subexpr (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaK_posfix(ls->fs,op,v,&v2);
^
ext/opcache/jit/ir/dynasm/minilua.c:4300:1: 0x108d0be in expr (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
subexpr(ls,v,0);
^
ext/opcache/jit/ir/dynasm/minilua.c:4376:1: 0x108cf95 in cond (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
expr(ls,&v);
^
ext/opcache/jit/ir/dynasm/minilua.c:4515:10: 0x108cc1d in test_then_block (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
condexit=cond(ls);
         ^
ext/opcache/jit/ir/dynasm/minilua.c:4524:7: 0x108a65a in ifstat (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
flist=test_then_block(ls);
      ^
ext/opcache/jit/ir/dynasm/minilua.c:4631:1: 0x108a3d2 in statement (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
ifstat(ls,line);
^
ext/opcache/jit/ir/dynasm/minilua.c:4683:8: 0x107b588 in chunk (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
islast=statement(ls);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:4076:1: 0x109a240 in body (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
chunk(ls);
^
ext/opcache/jit/ir/dynasm/minilua.c:4548:1: 0x108b3b7 in localfunc (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
body(ls,&b,0,ls->linenumber);
^
ext/opcache/jit/ir/dynasm/minilua.c:4659:1: 0x108a494 in statement (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
localfunc(ls);
^
ext/opcache/jit/ir/dynasm/minilua.c:4683:8: 0x107b588 in chunk (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
islast=statement(ls);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:3930:1: 0x10790ca in luaY_parser (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
chunk(&lexstate);
^
ext/opcache/jit/ir/dynasm/minilua.c:1241:4: 0x10786c4 in f_parser (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
tf=luaY_parser(L,p->z,
   ^
ext/opcache/jit/ir/dynasm/minilua.c:1044:1: 0x1021823 in luaD_rawrunprotected (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
LUAI_TRY(L,&lj,
^
ext/opcache/jit/ir/dynasm/minilua.c:1215:8: 0x1077c5f in luaD_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_rawrunprotected(L,func,u);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:1255:8: 0x10776e4 in luaD_protectedparser (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_pcall(L,f_parser,&p,savestack(L,L->top),L->errfunc);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:5795:8: 0x1076f30 in lua_load (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_protectedparser(L,&z,chunkname);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:6198:8: 0x1076e9d in luaL_loadbuffer (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
return lua_load(L,getS,&ls,name);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:6354:19: 0x1070ef1 in luaB_loadstring (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
return load_aux(L,luaL_loadbuffer(L,s,l,chunkname));
                  ^
ext/opcache/jit/ir/dynasm/minilua.c:1170:3: 0x103696c in luaD_precall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
n=(*curr_func(L)->c.f)(L);
  ^
ext/opcache/jit/ir/dynasm/minilua.c:5142:8: 0x10437b0 in luaV_execute (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
switch(luaD_precall(L,ra,nresults)){
       ^
ext/opcache/jit/ir/dynasm/minilua.c:1203:1: 0x1034395 in luaD_call (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaV_execute(L,1);
^
ext/opcache/jit/ir/dynasm/minilua.c:5768:1: 0x10c2a3d in f_call (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaD_call(L,c->func,c->nresults);
^
ext/opcache/jit/ir/dynasm/minilua.c:1044:1: 0x1021823 in luaD_rawrunprotected (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
LUAI_TRY(L,&lj,
^
ext/opcache/jit/ir/dynasm/minilua.c:1215:8: 0x1077c5f in luaD_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_rawrunprotected(L,func,u);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:5785:8: 0x101e3d2 in lua_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_pcall(L,f_call,&c,savestack(L,c.func),func);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:6383:8: 0x1070f86 in luaB_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=lua_pcall(L,lua_gettop(L)-1,(-1),0);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:1170:3: 0x103696c in luaD_precall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
n=(*curr_func(L)->c.f)(L);
  ^
ext/opcache/jit/ir/dynasm/minilua.c:5142:8: 0x10437b0 in luaV_execute (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
switch(luaD_precall(L,ra,nresults)){
       ^
ext/opcache/jit/ir/dynasm/minilua.c:1203:1: 0x1034395 in luaD_call (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaV_execute(L,1);
^
ext/opcache/jit/ir/dynasm/minilua.c:5768:1: 0x10c2a3d in f_call (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaD_call(L,c->func,c->nresults);
^
ext/opcache/jit/ir/dynasm/minilua.c:1044:1: 0x1021823 in luaD_rawrunprotected (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
LUAI_TRY(L,&lj,
^
ext/opcache/jit/ir/dynasm/minilua.c:1215:8: 0x1077c5f in luaD_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_rawrunprotected(L,func,u);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:5785:8: 0x101e3d2 in lua_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_pcall(L,f_call,&c,savestack(L,c.func),func);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:6383:8: 0x1070f86 in luaB_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=lua_pcall(L,lua_gettop(L)-1,(-1),0);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:1170:3: 0x103696c in luaD_precall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
n=(*curr_func(L)->c.f)(L);
  ^
ext/opcache/jit/ir/dynasm/minilua.c:5142:8: 0x10437b0 in luaV_execute (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
switch(luaD_precall(L,ra,nresults)){
       ^
ext/opcache/jit/ir/dynasm/minilua.c:1203:1: 0x1034395 in luaD_call (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaV_execute(L,1);
^
ext/opcache/jit/ir/dynasm/minilua.c:5768:1: 0x10c2a3d in f_call (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
luaD_call(L,c->func,c->nresults);
^
ext/opcache/jit/ir/dynasm/minilua.c:1044:1: 0x1021823 in luaD_rawrunprotected (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
LUAI_TRY(L,&lj,
^
ext/opcache/jit/ir/dynasm/minilua.c:1215:8: 0x1077c5f in luaD_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_rawrunprotected(L,func,u);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:5785:8: 0x101e3d2 in lua_pcall (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
status=luaD_pcall(L,f_call,&c,savestack(L,c.func),func);
       ^
ext/opcache/jit/ir/dynasm/minilua.c:7769:4: 0x101c380 in main (/home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/dynasm/minilua.c)
if(lua_pcall(L,argc-2,0,0)){
   ^
???:?:?: 0x7faaa8703347 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x7faaa8703347` was not available, trace may be incomplete

???:?:?: 0x7faaa870340a in ??? (libc.so.6)
/usr/lib/zig/libc/glibc/sysdeps/x86_64/start-2.33.S:120:0: 0x101c079 in ??? (/usr/lib/zig/libc/glibc/sysdeps/x86_64/start-2.33.S)
 call *__libc_start_main@GOTPCREL(%rip)

ext/opcache/jit/ir/gen_ir_fold_hash < /home/m/static-php-cli/source/php-src/ext/opcache/jit/ir/ir_fold.h > ext/opcache/jit/ir/ir_fold_hash.h
make: *** [Makefile:327: ext/opcache/jit/ir/ir_emit_x86.h] Aborted (core dumped)
make: *** Waiting for unfinished jobs....

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionNo questions on the issue tracker, please.zig ccZig as a drop-in C compiler feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions