Skip to content

Stale .hi files affect compilation.

I saw the following odd behaviour while playing with the example from #7446 (closed). Strangely, whether the warning (unusuable UNPACK pragma) is printed or not depends on the presence and contents of a .hi file despite of --fforce-recomp and even if the source file was modified.

> rm -f Peaker.*
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.1

> echo 'module Peaker(V(..)) where{ data V = V {-# UNPACK #-} !L; data L = L V }' > Peaker.hs
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'
> rm Peaker.hi
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'

> echo 'module Peaker(L(..)) where{ data V = V {-# UNPACK #-} !L; data L = L V }' > Peaker.hs
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )
> rm Peaker.hi
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'

> echo 'module Peaker(V(..)) where{ data V = V {-# UNPACK #-} !L; data L = L V }' > Peaker.hs
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'
> rm Peaker.hi
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )

Peaker.hs:1:38: Warning:
    Ignoring unusable UNPACK pragma on the first argument of `V'
    In the definition of data constructor `V'
    In the data declaration for `V'
Trac metadata
Trac field Value
Version 7.6.1
Type Bug
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