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)

FlagDescriptionStatic/DynamicReverse
-?helpstatic-
-helphelpstatic-
-vverbose mode (equivalent to -v3)dynamic-
-vnset verbosity leveldynamic-
––versiondisplay GHC versionstatic-
––numeric-versiondisplay GHC version (numeric only)static-
––print-libdirdisplay GHC library directorystatic-

4.19.2. Which phases to run (Section 4.6)

FlagDescriptionStatic/DynamicReverse
-EStop after preprocessing (.hspp file)static-
-CStop after generating C (.hc file)static-
-SStop after generating assembly (.s file)static-
-cStop after compiling to object code (.o file)static-

4.19.3. Redirecting output (Section 4.7)

FlagDescriptionStatic/DynamicReverse
-hcsuf suffixset the suffix to use for intermediate C filesstatic-
-hidir dirset directory for interface filesstatic-
-hisuf suffixset the suffix to use for interface filesstatic-
-o filenameset output filenamestatic-
-odir dirset output directorystatic-
-ohi filenameset the filename in which to put the interfacestatic 
-osuf suffixset the output file suffixstatic-

4.19.4. Keeping intermediate files (Section 4.7.1)

FlagDescriptionStatic/DynamicReverse
-keep-hc-fileretain intermediate .hc filesstatic-
-keep-s-fileretain intermediate .s filesstatic-
-keep-raw-s-fileretain intermediate .raw_s filesstatic-
-keep-tmp-filesretain all intermediate temporary filesstatic-

4.19.5. Temporary files (Section 4.7.2)

FlagDescriptionStatic/DynamicReverse
-tmpdirset the directory for temporary filesstatic-

4.19.6. Finding imports (Section 4.9.2)

FlagDescriptionStatic/DynamicReverse
-idir1:dir2:...add dir, dir2, etc. to import pathstatic-
-iEmpty the import directory liststatic-

4.19.7. Interface file options (Section 4.9.4)

FlagDescriptionStatic/DynamicReverse
-ddump-hiDump the new interface to stdoutdynamic-
-ddump-hi-diffsShow the differences vs. the old interfacedynamic-
--show-iface fileRead the interface in file and dump it as text to stdout.static-

4.19.8. Recompilation checking (Section 4.9.5)

FlagDescriptionStatic/DynamicReverse
-no-recompTurn off recompilation checkingstatic-recomp

4.19.9. Interactive-mode options (Section 3.8)

FlagDescriptionStatic/DynamicReverse
-ignore-dot-ghciDisable reading of .ghci filesstatic-
-read-dot-ghciEnable reading of .ghci filesstatic-

4.19.10. Packages (Section 4.10)

FlagDescriptionStatic/DynamicReverse
-package nameUse package namestatic-
-package-conf fileLoad more packages from filestatic-
-package-name nameCompile code for package namestatic-

4.19.11. Language options (Section 7.1)

FlagDescriptionStatic/DynamicReverse
-fallow-overlapping-instances dynamic-fno-allow-overlapping-instances
-fallow-undecidable-instancesEnable undecidable instancesdynamic-fno-allow-undecidable-instances
-fgenericsEnable genericsdynamic-fno-fgenerics
-fglasgow-extsEnable most language extensionsdynamic-fno-glasgow-exts
-ffi or -fffiEnable foreign function interface (implied by -fglasgow-exts)dynamic-fno-ffi
-fwithEnable deprecated with keyworddynamic-fno-with
-fignore-assertsIgnore assertionsdynamic-fno-ignore-asserts
-fno-implicit-preludeDon't implicitly import Preludedynamic-
-fno-monomorphism-restrictionDisable the monomorphism restrictiondynamic-
-firrefutable-tuplesMake tuple pattern matching irrefutabledynamic-fno-irrefutable-tuples
-fcontext-stacknset the limit for context reductiondynamic-

4.19.12. Warnings (Section 4.8)

FlagDescriptionStatic/DynamicReverse
-Wenable normal warningsdynamic-w
-wdisable all warningsdynamic-
-Wallenable all warningsdynamic-w
-fwarn-deprecationswarn about uses of functions & types that are deprecateddynamic-fno-warn-deprecations
-fwarn-duplicate-exportswarn when an entity is exported multiple timesdynamic-fno-warn-duplicate-exports
-fwarn-hi-shadowingwarn when a .hi file in the current directory shadows a librarydynamic-fno-warn-hi-shadowing
-fwarn-incomplete-patternswarn when a pattern match could faildynamic-fno-warn-incomplete-patterns
-fwarn-miscenable miscellaneous warningsdynamic-fno-warn-misc
-fwarn-missing-fieldswarn when fields of a record are uninitialiseddynamic-fno-warn-missing-fields
-fwarn-missing-methodswarn when class methods are undefineddynamic-fno-warn-missing-methods
-fwarn-missing-signatureswarn about top-level functions without signaturesdynamic-fno-warn-missing-signatures
-fwarn-name-shadowingwarn when names are shadoweddynamic-fno-warn-name-shadowing
-fwarn-overlapping-patternswarn about overlapping patternsdynamic-fno-warn-overlapping-patterns
-fwarn-simple-patternswarn about lambda-patterns that can faildynamic-fno-warn-simple-patterns
-fwarn-type-defaultswarn when defaulting happensdynamic-fno-warn-type-defaults
-fwarn-unused-bindswarn about bindings that are unuseddynamic-fno-warn-unused-binds
-fwarn-unused-importswarn about unnecessary importsdynamic-fno-warn-unused-imports
-fwarn-unused-matcheswarn about variables in patterns that aren't useddynamic-fno-warn-unused-matches

4.19.13. Optimisation levels (Section 4.11)

FlagDescriptionStatic/DynamicReverse
-OEnable default optimisation (level 1)static-O0
-OnSet optimisation level nstatic-O0

4.19.14. Individual optimisations (Section 4.11.2)

FlagDescriptionStatic/DynamicReverse
-fcase-mergeEnable case-mergingstatic-fno-case-merge
-fdicts-strictMake dictionaries strictdynamic-fno-dicts-strict
-fdo-eta-reductionEnable eta-reductionstatic-fno-do-eta-reduction
-fdo-lambda-eta-expansionEnable lambda eta-reductionstatic-fno-do-lambda-eta-expansion
-fexcess-precisionEnable excess intermediate precisionstatic-fno-excess-precision
-ffoldr-build-onEnable foldr-build optimisationstatic-fno-foldr-build-on
-fignore-assertsIgnore assertions in the sourcestatic-fno-ignore-asserts
-fignore-interface-pragmasIgnore pragmas in interface filesstatic-fno-ignore-interface-pragmas
-flet-no-escapeEnable let-no-escape optimisationstatic-fno-let-no-escape
-fliberate-case-thresholdTweak the liberate-case optimisation (default: 10)static-fno-liberate-case-threshold
-fomit-interface-pragmasDon't generate interface pragmasstatic-fno-omit-interface-pragmas
-fmax-worker-argsIf a worker has that many arguments, none will be unpacked anymore (default: 10)static-
-fmax-simplifier-iterationsSet the max iterations for the simplifierstatic-
-fno-cprTurn off CPR analysisstatic-
-fno-cseTurn off common sub-expressionstatic-
-fno-pre-inliningTurn off pre-inliningstatic-
-fno-strictnessTurn off strictness analysisstatic-
-fnumbers-strictMake numbers strictdynamic-fno-numbers-strict
-funbox-strict-fieldsFlatten strict constructor fieldsstatic-fno-unbox-strict-fields
-funfolding-creation-thresholdTweak unfolding settingsstatic-fno-unfolding-creation-threshold
-funfolding-fun-discountTweak unfolding settingsstatic-fno-unfolding-fun-discount
-funfolding-keeness-factorTweak unfolding settingsstatic-fno-unfolding-keeness-factor
-funfolding-update-in-placeTweak unfolding settingsstatic-fno-unfolding-update-in-place
-funfolding-use-thresholdTweak unfolding settingsstatic-fno-unfolding-use-threshold
-fusagespTurn on UsageSP analysisstatic-fno-usagesp

4.19.15. Profiling options (Chapter 5)

FlagDescriptionStatic/DynamicReverse
-autoAuto-add _scc_s to all exported functionsstatic-no-auto
-auto-allAuto-add _scc_s to all top-level functionsstatic-no-auto-all
-auto-dictsAuto-add _scc_s to all dictionariesstatic-no-auto-dicts
-caf-allAuto-add _scc_s to all CAFsstatic-no-caf-all
-profTurn on profilingstatic-
-tickyTurn on ticky-ticky profilingstatic-

4.19.16. Parallelism options (Section 4.14)

FlagDescriptionStatic/DynamicReverse
-gransimEnable GRANSIMstatic-
-parallelEnable Parallel Haskellstatic-
-smpEnable SMP supportstatic-

4.19.17. C pre-processor options (Section 4.12.3)

FlagDescriptionStatic/DynamicReverse
-cppRun the C pre-processor on Haskell source filesdynamic-
-Dsymbol[=value]Define a symbol in the C pre-processordynamic-Usymbol
-UsymbolUndefine a symbol in the C pre-processordynamic-
-IdirAdd dir to the directory search list for #include filesstatic-

4.19.18. C compiler options (Section 4.12.5)

FlagDescriptionStatic/DynamicReverse
-#include fileInclude file when compiling the .hc filedynamic-

4.19.19. Code generation options (Section 4.12.6)

FlagDescriptionStatic/DynamicReverse
-fasmUse the native code generatordynamic-fvia-C
-fvia-CCompile via Cdynamic-fasm
-fno-codeOmit code generationstatic-

4.19.20. Linking options (Section 4.12.7)

FlagDescriptionStatic/DynamicReverse
-dynamicUse dynamic Haskell libraries (if available)static-
-llibLink in library libstatic-
-LdirAdd dir to the list of directories searched for librariesstatic-
-package nameLink in package namestatic-
-framework nameOn Darwin/MacOS X only, link in the framework name. This option corresponds to the -framework option for Apple's Linker.static-
-framework-path nameOn 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-objsSplit objects (for libraries)static-
-staticUse static Haskell librariesstatic-
-no-hs-mainDon't asssume this program contains mainstatic-

4.19.21. Replacing phases (Section 4.12.1)

FlagDescriptionStatic/DynamicReverse
-pgmL cmdUse cmd as the literate pre-processorstatic-
-pgmP cmdUse cmd as the C pre-processor (with -cpp only)static-
-pgmc cmdUse cmd as the C compilerstatic-
-pgma cmdUse cmd as the assemblerstatic-
-pgml cmdUse cmd as the linkerstatic-
-pgmdll cmdUse cmd as the DLL generatorstatic-
-pgmdep cmdUse cmd as the dependency generatorstatic-
-pgmF cmdUse cmd as the pre-processor (with -F only)static-

4.19.22. Forcing options to particular phases (Section 4.12.2)

FlagDescriptionStatic/DynamicReverse
-optL optionpass option to the literate pre-processordynamic-
-optP optionpass option to cpp (with -cpp only)dynamic-
-optc optionpass option to the C compilerdynamic-
-opta optionpass option to the assemblerdynamic-
-optl optionpass option to the linkerstatic-
-optdll optionpass option to the DLL generatorstatic-
-optdep optionpass option to the dependency generatorstatic-

4.19.23. Platform-specific options (Section 4.15)

FlagDescriptionStatic/DynamicReverse
-mv8(SPARC only) enable version 8 supportstatic-
-monly-[32]-regs(x86 only) give some registers back to the C compilerdynamic-

4.19.24. External core file options (Section 4.17)

FlagDescriptionStatic/DynamicReverse
-fext-coreGenerate .hcr external Core filesstatic-

4.19.25. Compiler debugging options (Section 4.18)

FlagDescriptionStatic/DynamicReverse
-dcore-lintTurn on internal sanity checkingdynamic-
-ddump-absCDump abstract Cdynamic-
-ddump-asmDump assemblydynamic-
-ddump-bcosDump interpreter byte codedynamic-
-ddump-cpranalDump output from CPR analysisdynamic-
-ddump-cseDump CSE outputdynamic-
-ddump-derivDump deriving outputdynamic-
-ddump-dsDump desugarer outputdynamic-
-ddump-flatCDump “flat” Cdynamic-
-ddump-foreignDump foreign export stubsdynamic-
-ddump-inliningsDump inlining infodynamic-
-ddump-occur-analDump occurrence analysis outputdynamic-
-ddump-parsedDump parse treedynamic-
-ddump-realCDump “real” Cdynamic-
-ddump-rnDump renamer outputdynamic-
-ddump-rulesDump rulesdynamic-
-ddump-satDump saturated outputdynamic-
-ddump-simplDump final simplifier outputdynamic-
-ddump-simpl-iterationsDump output from each simplifier iterationdynamic-
-ddump-specDump specialiser outputdynamic-
-ddump-stgDump final STGdynamic-
-ddump-stranalDump strictness analyser outputdynamic-
-ddump-tcDump typechecker outputdynamic-
-ddump-typesDump type signaturesdynamic-
-ddump-usagespDump UsageSP analysis outputdynamic-
-ddump-worker-wrapperDump worker-wrapper outputdynamic-
-ddump-rn-traceTrace renamerdynamic-
-ddump-rn-statsRenamer statsdynamic-
-ddump-stixNative code generator intermediate formdynamic-
-ddump-simpl-statsDump simplifier statsdynamic-
-dppr-debugTurn on debug printing (more verbose)static-
-dppr-nopragsDon't output pragma info in dumpsstatic-
-dppr-user-lengthSet the depth for printing expressions in error msgsstatic-
-dsource-statsDump haskell source statsdynamic-
-dstg-lintSTG pass sanity checkingdynamic-
-dstg-statsDump STG statsdynamic-
-dusagesp-lintUsageSP sanity checkerdynamic-
-dverbose-core2coreShow output from each core-to-core passdynamic-
-dverbose-stg2stgShow output from each STG-to-STG passdynamic-
-unregEnable unregisterised compilationstatic-

4.19.26. Misc compiler options

FlagDescriptionStatic/DynamicReverse
-funfold-casms-in-hi-fileAllow casms in unfoldingsstatic-
-femit-extern-decls???static-
-fglobalise-toplev-namesMake all top-level names global (for -split-objs)static-
-fno-hi-version-checkDon't complain about .hi file mismatchesstatic-
-dno-black-holingTurn off black holing (probably doesn't work)static-
-fno-method-sharingDon't share specialisations of overloaded functionsstatic-
-fno-prune-declsRenamer: don't prune declarationsstatic-
-fno-prune-tydeclsRenamer: don't prune type declarationsstatic-
-fhistory-sizeSet simplification history sizestatic-
-funregisterisedUnregisterised compilation (use -unreg instead)static-
-fno-asm-manglingTurn off assembly mangling (use -unreg instead)static-