Give more graceful error message when compiling Array 0 to C99?
#649
RyanGlScott
started this conversation in
General
Replies: 2 comments 4 replies
-
|
What module would that be in? Should we make it part of: |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
@RyanGlScott @ivanperez-keera FWIW I have a pretty trivial patch for this that raises the error in copilot-c99 (so only rejects empty arrays in the c999 backend): Is this worthy of promotion to an issue and PR? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It is possible to define a Copilot
Arrayof length0. For example:This is a bit weird, as you can't really do much with the resulting array (for instance, you can't index into it), but this is nevertheless a legal stream definition in Copilot. In fact, you can compile this to Bluespec and simulate it:
Interestingly, if you replace the
import Copilot.Compile.Bluespecline withimport Copilot.Compile.C99, then Copilot crashes outright if you try to compile it:I don't believe that C99 permits empty arrays, so it is somewhat understandable that Copilot would reject this program. Still, it would be nicer if Copilot threw a proper error message here rather than crashing with a generic
NonEmpty.fromList: empty listerror, which leakscopilot-c99's internals.Beta Was this translation helpful? Give feedback.
All reactions