Uh oh!
There was an error while loading. Please reload this page.
copilot-c99: Raise error when compiling empty array or struct. Refs #695. - #713
Conversation
ac9e0ad to
1fbc348Comparecopilot-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.Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Change Manager: Can you please change the commit messages to the following. First commit: Second commit: Commit 3: |
…opilot-Language#695. 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. Moreover, copilot-c99 will often crash if you attempt to compile a Copilot specification that uses an empty array or struct. 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.
1fbc348 to
dc0c886Comparechathhorn
commented
Mar 6, 2026
Implementor: Fix implemented, review requested. |
…Copilot-Language#695. 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. Moreover, copilot-c99 will often crash if you attempt to compile a Copilot specification that uses an empty array or struct. A prior commit introduced a solution for this problem that makes the C99 backend detect these undesired struct or array types. This commit adds a test to check that attempting to compile specs containing zero-length arrays or empty structs to C99 raises an appropriate error.
dc0c886 to
a012695Compareivanperez-keera
commented
Mar 6, 2026
Change Manager: Process deviation. Change Manger communicated with Implementor via email to notify of required change. Hand off back to Change Manager for verification communicated via email by Implementor. |
Change Manager: Verified that:
|
Uh oh!
There was an error while loading. Please reload this page.
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.