Skip to content

"Unusable UNPACK pragma" warnings should be printed even without -O

UNPACK pragmas are ignored when -O is not used, and this is very annoying when developing inside GHCi. Example:

➜  unpack_warning  ghc-stage2 Main.hs -Wall -fforce-recomp --make
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...

No warning printed even though I used -Wall. If I add -O:

➜  unpack_warning  ghc-stage2 Main.hs -Wall -fforce-recomp --make -O
[1 of 1] Compiling Main             ( Main.hs, Main.o )

Main.hs:5:13: warning:
    • Ignoring unusable UNPACK pragma on the first argument of ‘Blah’
    • In the definition of data constructor ‘Blah’
      In the data type declaration for ‘Blah’
Linking Main ...

This is very annoying, because -O is ignored in GHCi:

➜  unpack_warning  ghc-stage2 Main.hs -Wall -fforce-recomp  -O --interactive

when making flags consistent: warning:
    -O conflicts with --interactive; -O ignored.
GHCi, version 7.11.20151220: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Main.hs, interpreted )
Ok, modules loaded: Main.

So basically there's no way to get these warning in GHCi.

Trac metadata
Trac field Value
Version 7.11
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information