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

Switch statement not correctly translated when default case is not present #2986

Closed

Conversation

github-sajan
Copy link
Contributor

…esent

@mihaibudiu
Copy link
Contributor

Why isn't the default case present? Previous passes should have inserted one.

@github-sajan
Copy link
Contributor Author

Why isn't the default case present? Previous passes should have inserted one.

Why isn't the default case present? Previous passes should have inserted one.

Currently, in "SwitchAddDefault" pass in frontend, default entry in switch is only inserted if the expression is based on "Action Type" or "action_run". There is no implementation for adding default entry for generic switch statement with integer or enumerated type expression.

So, as processing for switch statement with integer or enumerated type expression is done in "EliminateSwitch" pass in midend, implementation for adding default entry has been added here if it is not present

@github-sajan github-sajan force-pushed the switch_default-case-fix branch 3 times, most recently from fd53229 to 71063aa Compare December 15, 2021 11:58
@mihaibudiu
Copy link
Contributor

I have already approved this, but you still have conflicts that you need to rebase.

@github-sajan github-sajan force-pushed the switch_default-case-fix branch from 84c3938 to dea163f Compare December 20, 2021 04:18
@github-sajan
Copy link
Contributor Author

I have already approved this, but you still have conflicts that you need to rebase.

I have resolved the conflict. Kindly approve and merge

@mihaibudiu
Copy link
Contributor

If the extra spaces appeared after you rebased there is a bug somewhere else in the compiler that we should track.

@github-sajan github-sajan force-pushed the switch_default-case-fix branch from dea163f to f9b72a5 Compare December 22, 2021 06:18
@github-sajan github-sajan force-pushed the switch_default-case-fix branch from d822214 to ae63850 Compare December 22, 2021 06:51
@github-sajan
Copy link
Contributor Author

If the extra spaces appeared after you rebased there is a bug somewhere else in the compiler that we should track.

I have raised a new PR for the same and closing this out due to other irrelevant files getting updated while resolving conflict and rebasing. Kindly check and approve for the same
#3002

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.

3 participants