Better error message for attempt to subtract with overflow
#445
Labels
C: Internals
Component: Compiler internals
attempt to subtract with overflow
#445
When doing arithmetic on parameters, sometimes the compiler will throw an
attempt to subtract with overflow
error if you try doing a subtraction that results in a negative number. The error comes from Rust, and happens sometime during the monomorphize pass because parameter values are treated asu64
s, so of course they can't be negative. I've had this error pop up a few times because it can be easy to make small mistakes in complicated designs with lots of parameters and parameter arithmetic. If the Filament compiler emitted a proper error message for this that points to the place in the source code where the subtraction happens, it would be easier to debug the design. Off the top of my head, I'm not sure how easy this would be because I'm not sure how much of the source-level mapping information is retained by the time we're in monomorphize.The text was updated successfully, but these errors were encountered: