Skip to content

AOT: mktime() module verification fails — mkt_false/ok blocks land in wrong function (ext/date/php_date.c) #33934

Closed

Description

@PurHur

Category

bug · php-src-strict · AOT mktime invalid IR

Problem

mktime(0,0,0,1,1,2020) matches Zend/VM, but thin AOT fails module verification:

Module verification failed due to Referring to an argument in another function!
  call void @__value__writeBool(%__value__* %7, i32 0)
Referring to a basic block in another function!
  br i1 %12, label %mkt_false, label %mkt_ok
 in .../Module.php:180

Root cause: lib/JIT/Builtin/StringMktime.php builds __compiler_mktime with $fn->appendBasicBlock for entry/body, then uses BasicBlockHelper::append for mkt_false / mkt_ok / mkt_done. While lowering user main, context->loweringLlvmFunction steals those appends into the wrong function (see BasicBlockHelper::parentFunction / #31101). Same pattern exists in StringGmmktime (often masked by compile-time fold).

Repro Zend / VM AOT (master @ 048672b)
echo mktime(0,0,0,1,1,2020); 1577836800 compile_failed Module.php:180
echo gmmktime(0,0,0,1,1,2020); 1577836800 OK (host fold)

php-src reference

PHP implementation target

  • lib/JIT/Builtin/StringMktime.php — append mkt_false/mkt_ok/mkt_done on $fn (and/or scope loweringLlvmFunction); same for StringGmmktime.php
  • No new runtime/*.c

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_LLVM_ASSERT=1 php bin/compile.php -o /tmp/m.bin - <<'"'"'PHP'
<?php echo mktime(0,0,0,1,1,2020), "\n";
PHP
/tmp/m.bin'

Done when

  • AOT matches Zend for mktime full-arity literals and a runtime-arg path
  • ./script/aot-smoke.sh stays 8/8
  • Unit/repro guard under test/unit/ + test/repro/

Activity

  1. added
    bugSomething isn't working
    phase-3:aotPhase 3 – AOT deployment
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 22, 2026
  2. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: advanced-stdlib/ext — starting this run (AOT mktime Module.php:180 wrong-function basic blocks in StringMktime; aot-smoke 8/8; #32122/#31968/#33929/#33930 closed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-3:aotPhase 3 – AOT deployment

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions