Opened 2 years ago

Closed 2 years ago

#7447 closed bug (fixed)

Stale .hi files affect compilation.

Reported by: int-e Owned by:
Priority: high Milestone: 7.6.2
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I saw the following odd behaviour while playing with the example from #7446. 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'

Change History (2)

comment:1 Changed 2 years ago by simonmar

  • difficulty set to Unknown
  • Milestone set to 7.6.2
  • Priority changed from normal to high
  • Type of failure changed from None/Unknown to Incorrect warning at compile-time

Reproduced, and it still happens with HEAD. Here's the relevant bit:

> 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 )
>

The warning should have been produced the second time.

comment:2 Changed 2 years ago by parcs

  • Resolution set to fixed
  • Status changed from new to closed

This is what I get with current HEAD:

> 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 )
> ghc -fforce-recomp -O1 Peaker.hs
[1 of 1] Compiling Peaker           ( Peaker.hs, Peaker.o )
>

The warning is no longer produced at all, which I think is the correct behavior because there is no reason that L shouldn't be able to get unpacked into V. So I think it's OK to close the ticket.

Note: See TracTickets for help on using tickets.