copilot-c99: Raise error when compiling empty array or struct. Refs #695.#713
Open
chathhorn-galois wants to merge 3 commits intoCopilot-Language:masterfrom
Open
copilot-c99: Raise error when compiling empty array or struct. Refs #695.#713chathhorn-galois wants to merge 3 commits intoCopilot-Language:masterfrom
copilot-c99: Raise error when compiling empty array or struct. Refs #695.#713chathhorn-galois wants to merge 3 commits intoCopilot-Language:masterfrom
Conversation
…opilot-Language#695. Because they are not supported by C99, this commit raises an appropriate error when attempting to translate a zero-length array or a struct with no fields to C99. Previously, Copilot would either crash with a confusing error or silently translate the offending spec to invalid C99.
…Copilot-Language#695. Because they are not supported by C99, attempting to translate a zero-length array or a struct with no fields to C99 should fail. This commit adds a regression test to check that attempting to compile specs containing zero-length arrays or empty structs to C99 raises an apropriate error.
ac9e0ad to
1fbc348
Compare
copilot-c99: Raise an error when attempting to translate zero-length arrays or empty structs to C99. Refs #695.copilot-c99: Raise error when compiling zero-length arrays or empty structs to C99. Refs #695.
copilot-c99: Raise error when compiling zero-length arrays or empty structs to C99. Refs #695.copilot-c99: Raise error when compiling empty array or struct. Refs #695.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copilot allows defining empty arrays (i.e., values of type
Array 0) and empty structs (i.e., structs with no fields), but using empty arrays or structs in C99 is undefined behavior.copilot-c99will often crash if you attempt to compile a Copilot specification that uses an empty array or struct with an unhelpful error message (NonEmpty.fromList: empty list), but even if it doesn't, you're left with an invalid C program.This PR adds a check for attempts to translate specs that contain zero-length arrays or structs with no fields and raises an appropriate error, preventing such specs from being translated into invalid C.
Fixes #695.