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

fix: nullptr while fetching array size in pass array by data #3759

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

Pranavchiku
Copy link
Contributor

@Pranavchiku Pranavchiku commented Apr 2, 2024

Fixes #3756. With this PR we get stdlib_stats_median compiled to LLVM.

@Pranavchiku Pranavchiku added the asr pass Issue or pull request specific to ASR pass label Apr 2, 2024
@Pranavchiku Pranavchiku marked this pull request as ready for review April 3, 2024 04:59
@Pranavchiku
Copy link
Contributor Author

I am enabling auto merge since this is a small change, we can revert back and apply any changes we need in subsequent PRs.

@Pranavchiku Pranavchiku merged commit 0c548f7 into lfortran:main Apr 3, 2024
21 checks passed
length = ASRUtils::get_size(array, i + 1, al);
} else {
length = PassUtils::get_bound(array, i + 1, "ubound", al);
}
Copy link
Contributor

@certik certik Apr 3, 2024

Choose a reason for hiding this comment

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

What is going on here: for the above example it seems that both size and ubound is 9.

Is the issue that allocatable argument can have different lower and upper bound, say 10..19, while size is always 9? If so, the above test case does not seem to exercise this option. Finally, in ASR we always store the size (9) and lower bound (10). Here you are using ubound (19) and use it as "length".

That seems like a bug?

I created an issue for this at #3779.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I referred how did we populated start when it is nullptr, there we used lbound thus went for ubound in case of length = nullptr.

Will check and post a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asr pass Issue or pull request specific to ASR pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nullptr while fetching array size in pass array by data
2 participants