Ticket #2625 (new bug)
Unexpected -ddump-simpl output for derived Ord instance and UNPACKed fields
| Reported by: | aslatter | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | _|_ |
| Component: | Compiler | Version: | 6.8.3 |
| Keywords: | Cc: | aslatter@… | |
| Operating System: | Unknown/Multiple | Architecture: | x86_64 (amd64) |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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)
Change History
Note: See
TracTickets for help on using
tickets.
