#2354: NOINLINE pragma ignored
------------------------+---------------------------------------------------
    Reporter:  guest    |       Owner:          
        Type:  bug      |      Status:  new     
    Priority:  normal   |   Component:  Compiler
     Version:  6.9      |    Severity:  normal  
    Keywords:           |    Testcase:          
Architecture:  Unknown  |          Os:  Unknown 
------------------------+---------------------------------------------------
 Compile the following program

 {{{
 {-# OPTIONS_GHC -O -ddump-simpl #-}
 module F(test) where

 class AsInt a where
   {-# NOINLINE toInt #-}
   toInt   :: a -> Int
   {-# NOINLINE fromInt #-}
   fromInt :: Int -> a

 {-# INLINE onInt #-}
 onInt :: AsInt a => (Int -> Int) -> (a -> a)
 onInt f x = fromInt (f (toInt x))

 test :: AsInt a => (Int -> Int) -> (Int -> Int) -> (a -> a)
 test h g = onInt h . onInt g

 }}}

 Look at the final output for test:
 {{{
 F.test =
   \ (@ a_a6c)
     ($dAsInt_a6m :: F.AsInt a_a6c)
     (eta_s6B :: GHC.Base.Int -> GHC.Base.Int)
     (eta1_s6C :: GHC.Base.Int -> GHC.Base.Int)
     (eta2_s6D :: a_a6c) ->
     case $dAsInt_a6m of tpl_B1 { F.:DAsInt tpl1_B2 tpl2_B3 ->
     tpl2_B3 (eta_s6B (tpl1_B2 (tpl2_B3 (eta1_s6C (tpl1_B2 eta2_s6D)))))
 }}}
 The method (selectors) toInt and fromInt have been inlined despite the
 NOINLINE pragma.
 The compiler should either obey the pragma, or tell me that I can't have
 it in that place.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2354>
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

Reply via email to