Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[naga msl-out] Avoid UB by making all loops bounded. #6545

Merged
merged 1 commit into from
Nov 18, 2024

Commits on Nov 14, 2024

  1. [naga msl-out] Avoid UB by making all loops bounded.

    In MSL output, avoid undefined behavior due to unbounded loops by
    adding an unpredictable, never-actually-taken `break` to the bottom of
    each loop body, rather than adding an unpredictable,
    never-actually-taken branch over each loop.
    
    This will probably have more of a performance impact, because it
    affects each iteration of the loop, but unlike branching over the
    loop, which leaves infinite loops (and thus undefined behavior) in the
    output, this actually ensures that no loop presented to Metal is
    unbounded, so that there is no undefined behavior present that the
    optimizer could use to make unwelcome inferences.
    
    Fixes gfx-rs#6528.
    jimblandy committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    17198c2 View commit details
    Browse the repository at this point in the history