#2625: Unexpected -ddump-simpl output for derived Ord instance and UNPACKed
fields
-------------------------------+--------------------------------------------
Reporter: aslatter | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.8.3 | Severity: normal
Keywords: | Testcase:
Architecture: x86_64 (amd64) | Os: Unknown
-------------------------------+--------------------------------------------
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)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2625>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs