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

Dyno: fix promotion infinite recursion due to type returning functions #26296

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

DanilaFe
Copy link
Contributor

@DanilaFe DanilaFe commented Nov 21, 2024

On main, because we allowed promotion to be applied to functions with the type and param intents, it was possible to trigger recursive queries, in which chpl_promotionType would be applied in a promoted manner. As a concrete example, the following test by @riftEmber caused an infinite recursion error:

use OS;
var x = createSystemError(0);

This PR ensures that this no longer happens, by matching the production compiler's behavior and skipping type-returning procedures:

if (fn != NULL &&
fn->name != astrSassign &&
strcmp(fn->name, "these") != 0 &&
fn->retTag != RET_TYPE &&
fn->retTag != RET_PARAM &&
actualType->scalarPromotionType != NULL &&

Thank you @riftEmber for diagnosing the issue and reviewing the PR!

Testing

  • dyno tests, including regression test

@riftEmber riftEmber self-requested a review November 21, 2024 21:49
Copy link
Member

@riftEmber riftEmber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks for the fix

@DanilaFe DanilaFe merged commit ba9fa51 into chapel-lang:main Nov 21, 2024
7 checks passed
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