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

[Bugfix][Relay] Crash in match_exhaustion.cc when given an empty tuple pattern or constructor with no args #7459

Merged
merged 3 commits into from
Feb 17, 2021

Conversation

slyubomirsky
Copy link
Contributor

This PR adds two test cases that previously caused match exhaustion to crash due to a bad decision in implementing CartesianProduct. These cases happen when an empty tuple or constructor with no fields (e.g., Nil()) needs to be expanded -- the Cartesian product used for wildcard expansion assumed that it would have at least one field to expand. This was silly of me, since there is exactly one expansion of zero fields: {∅}.

I added a base case to CartesianProduct and regression tests.

Please review @MarisaKirisame @jroesch. (Test case found through fuzzing.)

Copy link
Member

@jroesch jroesch left a comment

Choose a reason for hiding this comment

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

LGTM

@jroesch jroesch merged commit 77d2fe8 into apache:main Feb 17, 2021
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
…e pattern or constructor with no args (apache#7459)

* [match_exhaustion] Fix cartesian product to handle empty tuple patterns or constructors with no args

* Test cases do not actually exhibit the fixed bug

* Mistake in comment
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2021
…e pattern or constructor with no args (apache#7459)

* [match_exhaustion] Fix cartesian product to handle empty tuple patterns or constructors with no args

* Test cases do not actually exhibit the fixed bug

* Mistake in comment
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