#6122: INLINE pragma not obeyed
-------------------------------+--------------------------------------------
  Reporter:  augustss          |          Owner:                  
      Type:  bug               |         Status:  closed          
  Priority:  normal            |      Milestone:                  
 Component:  Compiler          |        Version:  7.4.1           
Resolution:  wontfix           |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown         
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------

Comment(by simonpj):

 The other difficulty is that you are are asking MUCH MORE than simply
 "obey INLINE".  If you meant that, then you'd get:
 {{{
 count 0 (floatRadix 1 ^ floatDigits 1)
 ==> let v = floatRadix 1 ^ floatDigits 1
     in if v < 10 then 0 else count (0+1) (v `quot` 10)
 ==> let v = floatRadix 1 ^ floatDigits 1
         v' = v `quot` 10
     in if v < 10 then n else
        if v' < 10 then 0+1 else count (0+1+1) (v' `quot` 10)
 ...etc firever...
 }}}
 Now you are expecting that the optimiser will statically evaluate
 `(floatRadix 1 ^ floatDigits 1)`, and `(v < 10)`, etc, AND will do so
 before infinitely unfolding `count`.  This is jolly delicate IMHO.

 I suppose one might try something like "only inline if not under a
 conditional", but even that is tricky in a lazy language where a
 conditional is just another function. Maybe only inline in the strict-
 evaluation path?

 Anyway it seems pretty tricky to me.  But I just wanted to be clear that
 simply honouring an INLINE is likely to be extremely fragile, which is why
 we don't do it.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6122#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to