Skip to content

Dyno: branch sensitive try-catch#27591

Merged
DanilaFe merged 2 commits intochapel-lang:mainfrom
DanilaFe:branch-sensitive-try-catch
Aug 7, 2025
Merged

Dyno: branch sensitive try-catch#27591
DanilaFe merged 2 commits intochapel-lang:mainfrom
DanilaFe:branch-sensitive-try-catch

Conversation

@DanilaFe
Copy link
Contributor

@DanilaFe DanilaFe commented Aug 1, 2025

Closes https://github.com/Cray/chapel-private/issues/7403.

This PR addresses an internal error caused by the try-catch pass expecting a resolution result where there is none. Since the resolver always sets the type of try-catch variables, I deduced the issue was due to the resolver never visiting the code that TryCatchAnalyzer (TCA) is handling.

Indeed, the Resolver visitor, as well as many other Dyno visitors, skip dead code. However, TCA was not hooked up to do this, and thus was visiting dead code and balking at the lack of resolution results. This PR adjusts the TCA to also be branch-sensitive, by having it inherit from BranchSensitiveVisitor and invoke the necessary methods.

Testing

  • dyno tests
  • test/types/range/cast-assign-init/casts-2.chpl resolves
  • paratest
  • paratest --dyno-resolve-only

Reviewed by @arifthpe -- thanks!

Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
Signed-off-by: Danila Fedorin <daniel.fedorin@hpe.com>
@arifthpe arifthpe self-requested a review August 6, 2025 17:18
@DanilaFe DanilaFe merged commit 8533329 into chapel-lang:main Aug 7, 2025
10 checks passed
DanilaFe added a commit that referenced this pull request Aug 22, 2025
Closes Cray/chapel-private#7624.

Follows up on #27591, which
introduced branch-sensitivity to try-catch analysis. What was missing
was a call to `markFatalError`, which is required when traversing calls
to `compilerError`, to tell the branch-sensitive visitor to stop
visiting subsequent code. Thus, in some cases, we'd try to access code
past the end of available resolution information, and crash. This should
fix that.

Notably, the error message / error handling for broken iterators (that
have `compilerError` in them) is not addressed by this PR. It's a
limitation of the compiler's handling of erroneous code, so it is taking
a bit of a back seat. See
Cray/chapel-private#7620 (the specific error
seen here) and Cray/chapel-private#7622, which
I am now realizing is probably the root cause.

## Testing
- [x] dyno tests
- [x] paratest
- [x] paratest `--dyno-resolve-only`

Reviewed by @benharsh -- thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants