Opened 4 years ago

Closed 4 years ago

#8602 closed bug (fixed)

Wrong argument order to Haskell pre-processor (-F, -pgmF, -optF)

Reported by: SimonHengel Owned by: hellertime
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


So far, and that is what is documented

Additional arguments to the pre-processor can be passed in using the -optF option. These are fed to cmd on the command line after the three standard input and output arguments.

However, GHC 7.7.20131026 passes additional arguments (specified with -optF) before the three standard arguments.

Steps to reproduce:

$ echo '{-# OPTIONS_GHC -F -pgmF ./ -optF bar #-}' > Foo.hs
$ echo 'echo $*' >
$ chmod +x
$ ghci Foo.hs

Expected result: Foo.hs Foo.hs /tmp/ghc16665_0/ghc16665_1.hspp bar is printed to stdout

Actual result: bar Foo.hs Foo.hs /tmp/ghc16665_0/ghc16665_1.hspp is printed to stdout

Attachments (2)

0001-Re-order-preprocessor-args-to-agree-with-User-Guide-.patch (934 bytes) - added by hellertime 4 years ago.
Fixes #8602
0001-Add-test-suite-for-8602.patch (1.6 KB) - added by hellertime 4 years ago.
Test suite for #8602

Download all attachments as: .zip

Change History (9)

comment:1 Changed 4 years ago by hellertime

Owner: set to hellertime

comment:2 Changed 4 years ago by hellertime

Status: newpatch

comment:3 Changed 4 years ago by hellertime

I swapped the arguments to (++) in runPp so that they match the documentation, and added a test to verify the correct operation.

Changed 4 years ago by hellertime

Test suite for #8602

comment:4 Changed 4 years ago by hellertime

I just re-formatted these patches so that my author information was reflecting the correct e-mail address.

comment:5 Changed 4 years ago by Austin Seipp <austin@…>

In 032969f7c7493d774958e65e61690bd2a995fbbc/ghc:

Re-order preprocessor args to agree with User Guide (fixes #8602)

The section of the User Guide in reference is 4.12.4

Signed-off-by: Austin Seipp <>

comment:6 Changed 4 years ago by Austin Seipp <austin@…>

In b7bc064e3cdd439eb54bc6f978a067aa2eef7927/testsuite:

Add test suite for #8602

Signed-off-by: Austin Seipp <>

comment:7 Changed 4 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged, thanks!

Note: See TracTickets for help on using tickets.