Chapter 10. What to do when something goes wrong
Prev |  | Next

# Chapter 10. What to do when something goes wrong

If you still have a problem after consulting this section, then you may have found a bug—please report it! See Section 1.3, “Reporting bugs in GHC” for details on how to report a bug and a list of things we'd like to know about your bug. If in doubt, send a report—we love mail from irate users :-!

(Section 13.1, “Haskell standards vs. Glasgow Haskell: language non-compliance ”, which describes Glasgow Haskell's shortcomings vs. the Haskell language definition, may also be of interest.)

## 10.1. When the compiler “does the wrong thing”

“Help! The compiler crashed (or `panic'd)!”

  These events are always bugs in the GHC system—please report them.

“This is a terrible error message.”

  If you think that GHC could have produced a better error message, please report it as a bug.

“What about this warning from the C compiler?”

  For example: “…warning: `Foo' declared `static' but never defined.” Unsightly, but shouldn't be a problem.

Sensitivity to `.hi` interface files:

  GHC is very sensitive about interface files. For example, if it picks up a non-standard `Prelude.hi` file, pretty terrible things will happen. If you turn on `-XNoImplicitPrelude`, the compiler will almost surely die, unless you know what you are doing.

  Furthermore, as sketched below, you may have big problems running programs compiled using unstable interfaces.

“I think GHC is producing incorrect code”:

  Unlikely :-) A useful be-more-paranoid option to give to GHC is `-dcore-lint`; this causes a “lint” pass to check for errors (notably type errors) after each Core-to-Core transformation pass. We run with `-dcore-lint` on all the time; it costs about 5% in compile time.

“Why did I get a link error?”

  If the linker complains about not finding `_<something>_fast`, then something is inconsistent: you probably didn't compile modules in the proper dependency order.

“Is this line number right?”

  On this score, GHC usually does pretty well, especially if you “allow” it to be off by one or two. In the case of an instance or class declaration, the line number may only point you to the declaration, not to a specific method.

  Please report line-number errors that you find particularly unhelpful.

Prev |  | Next
9.3. Compiler Plugins | Home | 10.2. When your program “does the wrong thing”