Skip to content

bizarre strictness analysis bug

This module:

module Test where

f :: Int -> Int -> Int
f 0 t = t
f i t = f (i-1) (t+1)

g :: Int -> Int -> Int
g 0 t = t
g i t = g (i-1) (t+1)

contains two identical functions, f and g. If we compile with -O2 -dverbose-core2core using HEAD, GHC derives different strictness for them:

Test.f [Occ=LoopBreaker]
  :: GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int
 ...
 Str=DmdType U(L)U(L)m,

Test.g [Occ=LoopBreaker]
  :: GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int
  ...
 Str=DmdType U(L)L,

The strictness on g is wrong (it should be strict in both arguments).

What is even more bizarre is that if you DELETE f, then g gets the correct strictness!

Trac metadata
Trac field Value
Version 7.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information