Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#2249 closed bug (wontfix)

Undeclared variable in cmm reports as panic

Reported by: millenix Owned by:
Priority: low Milestone: 6.12.3
Component: Compiler Version: 6.9
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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:

  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:

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.

Change History (4)

comment:1 Changed 11 years ago by simonmar

difficulty: Unknown
Milestone: 6.10 branch
Priority: normallow

I feel I should point out that GHC's .cmm compiler is not really intended to be used by anyone but us. Its diagnostics are terrible, it is almost completely undocumented, and we change it freely.

Anyway, I'll milestone this for 6.10 because we'll be doing a sweep over that code.

comment:2 Changed 10 years ago by igloo

Milestone: 6.10 branch6.12 branch

comment:3 Changed 9 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:4 Changed 9 years ago by igloo

Resolution: wontfix
Status: newclosed
Type of failure: None/Unknown

Given Simon's message, and the amount of time this has lingered, I'll close it as wontfix.

Note: See TracTickets for help on using tickets.