Skip to content

Prevent analyze_lifetimes use after free #163

Description

@ejmeitz

Temporaries inside analyze_lifetimes blocks can be used after the block creating unintuitive errors.

I propose that we replace all the variables names inside of the analyze_lifetimes that are marked as temporary. This will mean any uses after the block result in unnamed variable errors instead of silently calling legate.

The goal is to prevent

A = ...
B = ....
@analyze_lifetimes begin # prod is identified as temporary
      prod = A .* B
      C[:, :] .= prod.+ 2.0f0
end
product .+=  # Use after free

Proposed emitted code

A = ...
B = ....
@analyze_lifetimes begin 
      new_var = gensym() #wouldnt actually be defined like this, can be generated inside macro.
      $new_var= A .* B
      C[:, :] .= $new_var.+ 2.0f0
end
product .+=  # Name error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions