Unexpected -ddump-simpl output for derived Ord instance and UNPACKed fields
In the following example, with either -O or -O2
In the derived Eq instance for A, in '==' nothing ever gets re-packed into a B constructor.
However in the derived Ord instance, in the 'compile' function the code from -ddump-simpl shows that the RHS of 'compare' is unpacked from the 'A' constructor only to be repacked in 'B' constructor and then passed on to a different function.
Is there any way we can do for 'compare' what was done for '==' ?
Thanks
module Bug where
data A = A {-# UNPACK #-} !B
deriving (Eq, Ord)
data B = B {-# UNPACK #-} !Int
{-# UNPACK #-} !Int
{-# UNPACK #-} !Int
{-# UNPACK #-} !Int
{-# UNPACK #-} !Int
{-# UNPACK #-} !Int
{-# UNPACK #-} !Int
deriving (Eq, Ord)
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | aslatter@gmail.com |
Operating system | Unknown |
Architecture |