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

Verilog: enum constants may depend on elaboration-time constants #378

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

kroening
Copy link
Member

This postpones the conversion of enum base types and enum initializers to enable them to depend on other elaboration-time constants.

@kroening kroening force-pushed the dependent-enum-constants branch from 9c4c997 to 2a10285 Compare February 21, 2024 17:54
@kroening kroening marked this pull request as ready for review February 21, 2024 17:58
@@ -1344,7 +1349,16 @@ exprt verilog_typecheck_exprt::elaborate_constant_expression(exprt expr)

// We fall back to the simplifier to approximate
// the standard's definition of 'constant expression'.
return simplify_expr(expr, ns);
auto simplified_expr = simplify_expr(expr, ns);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Because we've been bitten by this in CBMC (cf. diffblue/cbmc#7856): any use of the simplifier in the front-end needs to make sure that the resulting expression still has a source location.

Copy link
Member Author

Choose a reason for hiding this comment

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

added

This postpones the conversion of enum base types and enum initializers to
enable them to depend on other elaboration-time constants.
@kroening kroening force-pushed the dependent-enum-constants branch from 2a10285 to 1dd80c4 Compare February 21, 2024 18:27
@kroening kroening merged commit 3678a7e into main Feb 21, 2024
@kroening kroening deleted the dependent-enum-constants branch February 21, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants