Flag reference

The Glasgow Haskell Compiler User's Guide, Version 5.04
Prev | Chapter 4. Using GHC | Next

# 4.19. Flag reference

This section is a quick-reference for GHC's command-line flags. For each flag, we also list its static/dynamic status (see Section 4.2), and the flag's opposite (if available).

## 4.19.1. Help and verbosity options (Section 4.4)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-?` | help | static | -
`-help` | help | static | -
`-v` | verbose mode (equivalent to `-v3`) | dynamic | -
`-v` `n` | set verbosity level | dynamic | -
`––version` | display GHC version | static | -
`––numeric-version` | display GHC version (numeric only) | static | -
`––print-libdir` | display GHC library directory | static | -

## 4.19.2. Which phases to run (Section 4.6)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-E` | Stop after preprocessing (`.hspp` file) | static | -
`-C` | Stop after generating C (`.hc` file) | static | -
`-S` | Stop after generating assembly (`.s` file) | static | -
`-c` | Stop after compiling to object code (`.o` file) | static | -

## 4.19.3. Redirecting output (Section 4.7)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-hcsuf` `suffix` | set the suffix to use for intermediate C files | static | -
`-hidir` `dir` | set directory for interface files | static | -
`-hisuf` `suffix` | set the suffix to use for interface files | static | -
`-o` `filename` | set output filename | static | -
`-odir` `dir` | set output directory | static | -
`-ohi` `filename` | set the filename in which to put the interface | static |
`-osuf` `suffix` | set the output file suffix | static | -

## 4.19.4. Keeping intermediate files (Section 4.7.1)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-keep-hc-file` | retain intermediate `.hc` files | static | -
`-keep-s-file` | retain intermediate `.s` files | static | -
`-keep-raw-s-file` | retain intermediate `.raw_s` files | static | -
`-keep-tmp-files` | retain all intermediate temporary files | static | -

## 4.19.5. Temporary files (Section 4.7.2)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-tmpdir` | set the directory for temporary files | static | -

## 4.19.6. Finding imports (Section 4.9.2)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-i` `dir1`:`dir2`:... | add `dir`, `dir2`, etc. to import path | static | -
`-i` | Empty the import directory list | static | -

## 4.19.7. Interface file options (Section 4.9.4)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-ddump-hi` | Dump the new interface to stdout | dynamic | -
`-ddump-hi-diffs` | Show the differences vs. the old interface | dynamic | -
`--show-iface` `file` | Read the interface in `file` and dump it as text to `stdout`. | static | -

## 4.19.8. Recompilation checking (Section 4.9.5)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-no-recomp` | Turn off recompilation checking | static | `-recomp`

## 4.19.9. Interactive-mode options (Section 3.8)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-ignore-dot-ghci` | Disable reading of `.ghci` files | static | -
`-read-dot-ghci` | Enable reading of `.ghci` files | static | -

## 4.19.10. Packages (Section 4.10)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-package` `name` | Use package `name` | static | -
`-package-conf` `file` | Load more packages from `file` | static | -
`-package-name` `name` | Compile code for package `name` | static | -

## 4.19.11. Language options (Section 7.1)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fallow-overlapping-instances` |  | dynamic | `-fno-allow-overlapping-instances`
`-fallow-undecidable-instances` | Enable undecidable instances | dynamic | `-fno-allow-undecidable-instances`
`-fgenerics` | Enable generics | dynamic | `-fno-fgenerics`
`-fglasgow-exts` | Enable most language extensions | dynamic | `-fno-glasgow-exts`
`-ffi` or `-fffi` | Enable foreign function interface (implied by `-fglasgow-exts`) | dynamic | `-fno-ffi`
`-fwith` | Enable deprecated `with` keyword | dynamic | `-fno-with`
`-fignore-asserts` | Ignore assertions | dynamic | `-fno-ignore-asserts`
`-fno-implicit-prelude` | Don't implicitly `import Prelude` | dynamic | -
`-fno-monomorphism-restriction` | Disable the monomorphism restriction | dynamic | `-`
`-firrefutable-tuples` | Make tuple pattern matching irrefutable | dynamic | `-fno-irrefutable-tuples`
`-fcontext-stack` `n` | set the limit for context reduction | dynamic | `-`

## 4.19.12. Warnings (Section 4.8)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-W` | enable normal warnings | dynamic | `-w`
`-w` | disable all warnings | dynamic | -
`-Wall` | enable all warnings | dynamic | `-w`
`-fwarn-deprecations` | warn about uses of functions & types that are deprecated | dynamic | `-fno-warn-deprecations`
`-fwarn-duplicate-exports` | warn when an entity is exported multiple times | dynamic | `-fno-warn-duplicate-exports`
`-fwarn-hi-shadowing` | warn when a `.hi` file in the current directory shadows a library | dynamic | `-fno-warn-hi-shadowing`
`-fwarn-incomplete-patterns` | warn when a pattern match could fail | dynamic | `-fno-warn-incomplete-patterns`
`-fwarn-misc` | enable miscellaneous warnings | dynamic | `-fno-warn-misc`
`-fwarn-missing-fields` | warn when fields of a record are uninitialised | dynamic | `-fno-warn-missing-fields`
`-fwarn-missing-methods` | warn when class methods are undefined | dynamic | `-fno-warn-missing-methods`
`-fwarn-missing-signatures` | warn about top-level functions without signatures | dynamic | `-fno-warn-missing-signatures`
`-fwarn-name-shadowing` | warn when names are shadowed | dynamic | `-fno-warn-name-shadowing`
`-fwarn-overlapping-patterns` | warn about overlapping patterns | dynamic | `-fno-warn-overlapping-patterns`
`-fwarn-simple-patterns` | warn about lambda-patterns that can fail | dynamic | `-fno-warn-simple-patterns`
`-fwarn-type-defaults` | warn when defaulting happens | dynamic | `-fno-warn-type-defaults`
`-fwarn-unused-binds` | warn about bindings that are unused | dynamic | `-fno-warn-unused-binds`
`-fwarn-unused-imports` | warn about unnecessary imports | dynamic | `-fno-warn-unused-imports`
`-fwarn-unused-matches` | warn about variables in patterns that aren't used | dynamic | `-fno-warn-unused-matches`

## 4.19.13. Optimisation levels (Section 4.11)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-O` | Enable default optimisation (level 1) | static | `-O0`
`-O` `n` | Set optimisation level `n` | static | `-O0`

## 4.19.14. Individual optimisations (Section 4.11.2)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fcase-merge` | Enable case-merging | static | `-fno-case-merge`
`-fdicts-strict` | Make dictionaries strict | dynamic | `-fno-dicts-strict`
`-fdo-eta-reduction` | Enable eta-reduction | static | `-fno-do-eta-reduction`
`-fdo-lambda-eta-expansion` | Enable lambda eta-reduction | static | `-fno-do-lambda-eta-expansion`
`-fexcess-precision` | Enable excess intermediate precision | static | `-fno-excess-precision`
`-ffoldr-build-on` | Enable foldr-build optimisation | static | `-fno-foldr-build-on`
`-fignore-asserts` | Ignore assertions in the source | static | `-fno-ignore-asserts`
`-fignore-interface-pragmas` | Ignore pragmas in interface files | static | `-fno-ignore-interface-pragmas`
`-flet-no-escape` | Enable let-no-escape optimisation | static | `-fno-let-no-escape`
`-fliberate-case-threshold` | Tweak the liberate-case optimisation (default: 10) | static | `-fno-liberate-case-threshold`
`-fomit-interface-pragmas` | Don't generate interface pragmas | static | `-fno-omit-interface-pragmas`
`-fmax-worker-args` | If a worker has that many arguments, none will be unpacked anymore (default: 10) | static | -
`-fmax-simplifier-iterations` | Set the max iterations for the simplifier | static | -
`-fno-cpr` | Turn off CPR analysis | static | -
`-fno-cse` | Turn off common sub-expression | static | -
`-fno-pre-inlining` | Turn off pre-inlining | static | -
`-fno-strictness` | Turn off strictness analysis | static | -
`-fnumbers-strict` | Make numbers strict | dynamic | `-fno-numbers-strict`
`-funbox-strict-fields` | Flatten strict constructor fields | static | `-fno-unbox-strict-fields`
`-funfolding-creation-threshold` | Tweak unfolding settings | static | `-fno-unfolding-creation-threshold`
`-funfolding-fun-discount` | Tweak unfolding settings | static | `-fno-unfolding-fun-discount`
`-funfolding-keeness-factor` | Tweak unfolding settings | static | `-fno-unfolding-keeness-factor`
`-funfolding-update-in-place` | Tweak unfolding settings | static | `-fno-unfolding-update-in-place`
`-funfolding-use-threshold` | Tweak unfolding settings | static | `-fno-unfolding-use-threshold`
`-fusagesp` | Turn on UsageSP analysis | static | `-fno-usagesp`

## 4.19.15. Profiling options (Chapter 5)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-auto` | Auto-add `_scc_`s to all exported functions | static | `-no-auto`
`-auto-all` | Auto-add `_scc_`s to all top-level functions | static | `-no-auto-all`
`-auto-dicts` | Auto-add `_scc_`s to all dictionaries | static | `-no-auto-dicts`
`-caf-all` | Auto-add `_scc_`s to all CAFs | static | `-no-caf-all`
`-prof` | Turn on profiling | static | -
`-ticky` | Turn on ticky-ticky profiling | static | -

## 4.19.16. Parallelism options (Section 4.14)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-gransim` | Enable GRANSIM | static | -
`-parallel` | Enable Parallel Haskell | static | -
`-smp` | Enable SMP support | static | -

## 4.19.17. C pre-processor options (Section 4.12.3)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-cpp` | Run the C pre-processor on Haskell source files | dynamic | -
`-D` `symbol`[=`value`] | Define a symbol in the C pre-processor | dynamic | `-U` `symbol`
`-U` `symbol` | Undefine a symbol in the C pre-processor | dynamic | -
`-I` `dir` | Add `dir` to the directory search list for `#include` files | static | -

## 4.19.18. C compiler options (Section 4.12.5)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-#include` `file` | Include `file` when compiling the `.hc` file | dynamic | -

## 4.19.19. Code generation options (Section 4.12.6)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fasm` | Use the native code generator | dynamic | -fvia-C
`-fvia-C` | Compile via C | dynamic | -fasm
`-fno-code` | Omit code generation | static | -

## 4.19.20. Linking options (Section 4.12.7)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-dynamic` | Use dynamic Haskell libraries (if available) | static | -
`-l` `lib` | Link in library `lib` | static | -
`-L` `dir` | Add `dir` to the list of directories searched for libraries | static | -
`-package` `name` | Link in package `name` | static | -
`-framework` `name` | On Darwin/MacOS X only, link in the framework `name`. This option corresponds to the `-framework` option for Apple's Linker. | static | -
`-framework-path` `name` | On Darwin/MacOS X only, add `dir` to the list of directories searched for frameworks. This option corresponds to the `-F` option for Apple's Linker. | static | -
`-split-objs` | Split objects (for libraries) | static | -
`-static` | Use static Haskell libraries | static | -
`-no-hs-main` | Don't asssume this program contains `main` | static | -

## 4.19.21. Replacing phases (Section 4.12.1)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-pgmL` `cmd` | Use `cmd` as the literate pre-processor | static | -
`-pgmP` `cmd` | Use `cmd` as the C pre-processor (with `-cpp` only) | static | -
`-pgmc` `cmd` | Use `cmd` as the C compiler | static | -
`-pgma` `cmd` | Use `cmd` as the assembler | static | -
`-pgml` `cmd` | Use `cmd` as the linker | static | -
`-pgmdll` `cmd` | Use `cmd` as the DLL generator | static | -
`-pgmdep` `cmd` | Use `cmd` as the dependency generator | static | -
`-pgmF` `cmd` | Use `cmd` as the pre-processor (with `-F` only) | static | -

## 4.19.22. Forcing options to particular phases (Section 4.12.2)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-optL` `option` | pass `option` to the literate pre-processor | dynamic | -
`-optP` `option` | pass `option` to cpp (with `-cpp` only) | dynamic | -
`-optc` `option` | pass `option` to the C compiler | dynamic | -
`-opta` `option` | pass `option` to the assembler | dynamic | -
`-optl` `option` | pass `option` to the linker | static | -
`-optdll` `option` | pass `option` to the DLL generator | static | -
`-optdep` `option` | pass `option` to the dependency generator | static | -

## 4.19.23. Platform-specific options (Section 4.15)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-mv8` | (SPARC only) enable version 8 support | static | -
`-monly-[32]-regs` | (x86 only) give some registers back to the C compiler | dynamic | -

## 4.19.24. External core file options (Section 4.17)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-fext-core` | Generate `.hcr` external Core files | static | -

## 4.19.25. Compiler debugging options (Section 4.18)

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-dcore-lint` | Turn on internal sanity checking | dynamic | -
`-ddump-absC` | Dump abstract C | dynamic | -
`-ddump-asm` | Dump assembly | dynamic | -
`-ddump-bcos` | Dump interpreter byte code | dynamic | -
`-ddump-cpranal` | Dump output from CPR analysis | dynamic | -
`-ddump-cse` | Dump CSE output | dynamic | -
`-ddump-deriv` | Dump deriving output | dynamic | -
`-ddump-ds` | Dump desugarer output | dynamic | -
`-ddump-flatC` | Dump “flat” C | dynamic | -
`-ddump-foreign` | Dump `foreign export` stubs | dynamic | -
`-ddump-inlinings` | Dump inlining info | dynamic | -
`-ddump-occur-anal` | Dump occurrence analysis output | dynamic | -
`-ddump-parsed` | Dump parse tree | dynamic | -
`-ddump-realC` | Dump “real” C | dynamic | -
`-ddump-rn` | Dump renamer output | dynamic | -
`-ddump-rules` | Dump rules | dynamic | -
`-ddump-sat` | Dump saturated output | dynamic | -
`-ddump-simpl` | Dump final simplifier output | dynamic | -
`-ddump-simpl-iterations` | Dump output from each simplifier iteration | dynamic | -
`-ddump-spec` | Dump specialiser output | dynamic | -
`-ddump-stg` | Dump final STG | dynamic | -
`-ddump-stranal` | Dump strictness analyser output | dynamic | -
`-ddump-tc` | Dump typechecker output | dynamic | -
`-ddump-types` | Dump type signatures | dynamic | -
`-ddump-usagesp` | Dump UsageSP analysis output | dynamic | -
`-ddump-worker-wrapper` | Dump worker-wrapper output | dynamic | -
`-ddump-rn-trace` | Trace renamer | dynamic | -
`-ddump-rn-stats` | Renamer stats | dynamic | -
`-ddump-stix` | Native code generator intermediate form | dynamic | -
`-ddump-simpl-stats` | Dump simplifier stats | dynamic | -
`-dppr-debug` | Turn on debug printing (more verbose) | static | -
`-dppr-noprags` | Don't output pragma info in dumps | static | -
`-dppr-user-length` | Set the depth for printing expressions in error msgs | static | -
`-dsource-stats` | Dump haskell source stats | dynamic | -
`-dstg-lint` | STG pass sanity checking | dynamic | -
`-dstg-stats` | Dump STG stats | dynamic | -
`-dusagesp-lint` | UsageSP sanity checker | dynamic | -
`-dverbose-core2core` | Show output from each core-to-core pass | dynamic | -
`-dverbose-stg2stg` | Show output from each STG-to-STG pass | dynamic | -
`-unreg` | Enable unregisterised compilation | static | -

## 4.19.26. Misc compiler options

Flag | Description | Static/Dynamic | Reverse
--- | --- | --- | ---
`-funfold-casms-in-hi-file` | Allow casms in unfoldings | static | -
`-femit-extern-decls` | ??? | static | -
`-fglobalise-toplev-names` | Make all top-level names global (for `-split-objs`) | static | -
`-fno-hi-version-check` | Don't complain about `.hi` file mismatches | static | -
`-dno-black-holing` | Turn off black holing (probably doesn't work) | static | -
`-fno-method-sharing` | Don't share specialisations of overloaded functions | static | -
`-fno-prune-decls` | Renamer: don't prune declarations | static | -
`-fno-prune-tydecls` | Renamer: don't prune type declarations | static | -
`-fhistory-size` | Set simplification history size | static | -
`-funregisterised` | Unregisterised compilation (use `-unreg` instead) | static | -
`-fno-asm-mangling` | Turn off assembly mangling (use `-unreg` instead) | static | -

Prev | Home | Next
Debugging the compiler | Up | Profiling