Skip to content

One expression of 86 nested U32 operators passes clang's bracket nesting limit (U32_BIN) #1123

Closed

Description

@nicolas-abril

What you did

bend wall.bend -o wall

What happened

wall.c:1319:705: fatal error: bracket nesting level exceeded maximum of 256
wall.c:552:27: note: expanded from macro 'U32_BIN'
1 error generated.
Error: clang failed to build wall

bend wall.bend prints 56684812. The body is one expression of 86 nested binary U32 operators over two reusable parameters; 85 build. Each U32_BIN expands to three parenthesis levels, so clang's limit of 256 is reached near 85 operators. The same chain written as sequential lets builds (one temporary each).

The file

import Base

def f(+a: U32, +b: U32) -> U32:
  ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((a + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32) - b : U32) * a : U32) + b : U32) .^. a : U32)

def main() -> IO(Unit):
  IO.print(U32.show(f(5, 7)))

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 [-]An Array of an equality type stops both emitters with "an open Array element type"[/-] [+]One expression of 86 nested U32 operators passes clang's bracket nesting limit (U32_BIN)[/+] 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