Skip to content

migrate: setjmp/longjmp (returns_twice calls, per-target jmp_buf) — blocks minizip's writer, libpng, libjpeg #1217

Open

Description

@ehartford

What. `with migrate` refuses any function that calls `setjmp` or `longjmp`:

```
migrate: untranslatable function 'zipAlreadyThere': setjmp/longjmp ('setjmp') is not supported at zip.c:472:9
migrate: untranslatable function 'set_alloc': setjmp/longjmp ('longjmp') is not supported at skipset.h:174:9
```

The refusal is loud and correct today. This issue is the work to support it.

Where it bites. zlib 1.3.2 `contrib/minizip/zip.c`: `zipAlreadyThere` sets a landing pad (`setjmp(zip->set.env)`) and `skipset.h`'s `set_alloc` `longjmp`s to it when `realloc` fails. There is no compile switch. So the zlib corpus stages minizip's reader, repair and ioapi, and the writer waits (`build/zlib.w`, `zlib_minizip_files`). libpng and libjpeg report every error this way, so it gates those migrations too.

What it needs.

Codegen/ABI: alone in its batch, with `:move-audit` and `:drop-audit`.

Done when. `zip.c` and `skipset.h` join `zlib_minizip_files()`, `std.zip` gains its writer, and a round trip (write, read back, compare) runs in the zlib corpus lanes.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced: still refused, loudly.

    $ cat input.c
    #include <setjmp.h>
    static jmp_buf env;
    int f(void) { if (setjmp(env)) return 1; longjmp(env, 1); return 0; }
    $ with migrate input.c -o out.w
    migrate: untranslatable function 'f': setjmp/longjmp ('setjmp') is not supported at input.c:3:19
    

    post-release: a migrator feature (returns_twice calls, per-target jmp_buf), multi-PR.

  2. added this to the post-v0.16.0 milestone on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions