Undeclared variable in cmm reports as panic
In CMM code, if one makes an assignment to a variable that's not been declared, the compiler panics, in addition to reporting an almost sensible error message.
Here's code to make it happen:
testingbug
{
var = 1;
}
And here's the output it causes:
ghc-6.9.20080305: panic! (the 'impossible' happened)
(GHC version 6.9.20080305 for x86_64-unknown-linux):
CmmParse: var not a register
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
I see two problems here:
- As the output notes, the compiler should not panic just because the user fed it noticeably bad code. It should just report the underlying message, with a line/column reference to the offending code.
- The error message should quote the variable name about which it's complaining. When I initially discovered this, the variable name in question was
data
, and that was rather confusing.
Trac metadata
Trac field | Value |
---|---|
Version | 6.9 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |