#2249: Undeclared variable in cmm reports as panic
-------------------------------+--------------------------------------------
    Reporter:  millenix        |       Owner:          
        Type:  bug             |      Status:  new     
    Priority:  normal          |   Component:  Compiler
     Version:  6.9             |    Severity:  minor   
    Keywords:                  |    Testcase:          
Architecture:  x86_64 (amd64)  |          Os:  Linux   
-------------------------------+--------------------------------------------
 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:
  1. 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.
  2. 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2249>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to