Skip to content

C lane: showing a pure main of an Array of ((U32, D), Unit) paired with one more such value prints garbage, then a memory fault #1129

Closed

Description

@nicolas-abril

What you did

bend pair_array.bend
bend pair_array.bend -o pair_array && ./pair_array
bend pair_array.bend -o pair_array.js && bun pair_array.js

What happened

bend:  ([((1, Db{}), Unit{})], (1, Db{}), Unit{})
JS:    ([((1, Db{}), Unit{})], (1, Db{}), Unit{})
C:     ([((1, Db{}), Unit{})], (7408178, bend: memory fault (machine stack overflow?)

The C binary shows the array right, then a garbage number for the second component's U32, then faults (exit 1). Same at every -O level and with --threads 1. Each part is needed: without the array, without the Unit layer, with a List instead of the Array, or with D replaced by Unit or a U32, it prints the right value. D may have more constructors (Da{}, Db{} fails the same way). Reduced from a fuzzer program; likely the same class as occasional "memory fault" findings on small pure mains that the fuzzer could not reproduce before.

The file

import Base

type D is Data:
  Db{}

def main() -> (Array<Sigma<&2, &2, Sigma<&2, &2, U32, _ => D>, _ => Unit>> & Sigma<&2, &2, Sigma<&2, &2, U32, _ => D>, _ => Unit>):
  ([((1, Db{}), Unit{}) : Sigma<&2, &2, Sigma<&2, &2, U32, _ => D>, _ => Unit>*1n], ((1, Db{}), Unit{}))

bend --version

Bend 2.0.32 (main d2066a52); also on 2.0.31 (af569d48)

uname -sm

Darwin arm64

clang --version (the first line)

Apple clang version 17.0.0 (clang-1700.6.4.2)

Found by the bend2 differential fuzzer.

Activity

  1. added
    bug
    on Sep 27, 2026
  2. changed the title [-]Metal: a `!` call reaching F32.show fail-stops with "a function the device does not hold"[/-] [+]C lane: showing a pure main of an Array of ((U32, D), Unit) paired with one more such value prints garbage, then a memory fault[/+] on Sep 27, 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

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions