Opened 5 years ago

Closed 5 years ago

#9565 closed bug (fixed)

T3500b exhaust simplifier ticks (loops?) on WAY=optasm

Reported by: slyfox Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.9
Keywords: Cc: simonpj
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case: simplCore/should_compile/T9565
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

$ make fulltest TEST="T3500b" WAY=optasm

=====> T3500b(optasm) 3767 of 4101 [0, 0, 0] 
cd ./typecheck/should_run && '/home/slyfox/dev/git/ghc-validate/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-history -o T3500b T3500b.hs -O -fasm   >T3500b.comp.stderr 2>&1
Compile failed (status 256) errors were:
[1 of 1] Compiling Main             ( T3500b.hs, T3500b.o )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 7.9.20140907 for x86_64-unknown-linux):
        Simplifier ticks exhausted
    When trying RuleFired foldr/augment
    To increase the limit, use -fsimpl-tick-factor=N (default 100)
    If you need to do this, let GHC HQ know, and what factor you needed
    To see detailed counts use -ddump-simpl-stats
    Total ticks: 12441

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Attempt to increase -fsimpl-tick-factor does not help copiling sample. Looks like infinite inlining pass.

The test source itself:

{-# LANGUAGE TypeFamilies, FlexibleContexts, UndecidableInstances #-}

module Main where

newtype Mu f = Mu (f (Mu f)) 
     
type family Id m
type instance Id m = m

instance Show (Id (f (Mu f))) => Show (Mu f) where
    show (Mu f) = show f

showMu :: Mu (Either ()) -> String
showMu = show

item :: Mu (Either ())
item = Mu (Right (Mu (Left ())))

main = print (showMu item)

Change History (5)

comment:1 Changed 5 years ago by carter

could this be an instance of the known issue about recursive types interacting with the inliner? https://www.haskell.org/ghc/docs/7.8.3/html/users_guide/bugs.html see the second item there

if i change the program to

{-# LANGUAGE TypeFamilies, FlexibleContexts, UndecidableInstances #-}

module Main where

newtype Mu f = Mu (f (Mu f))

type family Id m
type instance Id m = m

instance Show (Id (f (Mu f))) => Show (Mu f) where
    show (Mu f) = show f
    {-# NOINLINE show #-}

showMu :: Mu (Either ()) -> String
showMu = show

item :: Mu (Either ())
item = Mu (Right (Mu (Left ())))

main = print (showMu item)

that is, I mark the show instance NOINLINE, the problem goes away.

comment:2 Changed 5 years ago by slyfox

Oh, I see. I propose to mark it as expect_broken for opt targets if noone objects.

Thanks!

comment:3 Changed 5 years ago by carter

I'm not sure, its in the test suite which means it was working before right? Or is this part of the suite that's only run on a slow validate? I'll try to dig in once I'm off my phone. I also may have run the test case incorrectly on my local machine.

comment:4 Changed 5 years ago by Simon Peyton Jones <simonpj@…>

In 01906c7399301e4f69959ecbd3b0d8bee5d5ef70/ghc:

Test Trac #9565 and #9583

comment:5 Changed 5 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: T3500bsimplCore/should_compile/T9565

I'm happy to say that this is fixed by the same patch as #9583.

I've added a separate test case (compile only) since the purpose is different to the (identical) test for #3500.

Simon

Note: See TracTickets for help on using tickets.