Opened 7 years ago

Last modified 8 months ago

#4121 new task

Refactor the plumbing of CafInfo to make it more robust

Reported by: dterei Owned by:
Priority: low Milestone:
Component: Compiler Version: 6.12.2
Keywords: CodeGen Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

While comping GHC Head using the devel1 flavour and ghc-6.12.2 as the bootstrap compiler, I get the following assertion failure:

"inplace/bin/ghc-stage1"   -H64m -O -fasm    -package-name base-4.3.0.0 -hide-all-packages -i -ilibraries/base/. -ilibraries/base/dist-install/build -ilibraries/base/dist-install/build/autogen -Ilibraries/base/dist-install/build -Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include   -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.2.0.0 -package integer-gmp-0.2.0.0 -package rts-1.0  -package-name base -XMagicHash -XExistentialQuantification -XRank2Types -XScopedTypeVariables -XUnboxedTuples -XForeignFunctionInterface -XUnliftedFFITypes -XDeriveDataTypeable -XGeneralizedNewtypeDeriving -XFlexibleInstances -XStandaloneDeriving -XPatternGuards -XEmptyDataDecls -XNoImplicitPrelude -XCPP -no-user-package-conf -rtsopts -O -dcore-lint -fno-warn-deprecated-flags     -odir libraries/base/dist-install/build -hidir libraries/base/dist-install/build -stubdir libraries/base/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c libraries/base/./Control/Applicative.hs -o libraries/base/dist-install/build/Control/Applicative.o

WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
WARNING: file compiler/stgSyn/CoreToStg.lhs line 220
Control.Applicative.$fAlternativeSTM
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 6.13 for i386-unknown-linux):
	ASSERT failed! file compiler/stgSyn/CoreToStg.lhs line 187
...blah...
base:Control.Applicative.$fAlternativeSTM{v rk} [gid[DFunId]] =
    [] \u srt:SRT:[] []
        let {
          sat_s1oj{v} [lid] =
              [] \r srt:SRT:[] [eta_B1{v} [lid]] retry#{v} [eta_B1{v} [lid]];
        } in 
          base:Control.Applicative.D:Alternative{d rra} [base:Control.Applicative.$fApplicativeSTM{v r2q} [gid[DFunId]]
                                                         sat_s1oj{v} [lid]
                                                         base:GHC.Conc.orElse1{v re9} [gid]
                                                         base:Control.Applicative.$fAlternativeSTM3{v r2n} [gid]
                                                         base:Control.Applicative.$fAlternativeSTM1{v r2l} [gid]];

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

This is on the 32bit MSRC machine by the way. On my own laptop running Ubuntu 10.04 I don't get this (bootstrap compiler is 6.12.1 though).

Change History (14)

comment:1 Changed 7 years ago by igloo

Milestone: 6.14.1

Thanks for the report

comment:2 Changed 7 years ago by simonpj

Description: modified (diff)
Summary: Ghc stage1 panic, ASSERT failure: libraries/base/Control/Applicative.hsRefactor the plumbing of CafInfo to make it more robust

Fixed by

Mon Jun 14 14:27:26 BST 2010  simonpj@microsoft.com
  * Gruesome fix in CorePrep to fix embarassing Trac #4121
  
  This is a long-lurking bug that has been flushed into
  the open by other arity-related changes.  There's a
  long comment
  
       Note [CafInfo and floating]
  
  to explain.  
  
  I really hate the contortions we have to do through to keep correct
  CafRef information on top-level binders.  The Right Thing, I believe,
  is to compute CAF and arity information later, and merge it into the
  interface-file information when the latter is generated.
  
  But for now, this hackily fixes the problem.

    M ./compiler/coreSyn/CorePrep.lhs -40 +120

However we need a more general fix; Note [CafInfo and floating] concludes

This is all very gruesome and horrible. It would be better to figure
out CafInfo later, after CorePrep.  We'll do that in due course. 
Meanwhile this horrible hack works.

So I'll re-titling the ticket.

Simon

comment:3 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:4 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:5 Changed 6 years ago by igloo

Milestone: 7.2.17.4.1

comment:6 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: normallow

comment:7 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:8 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:9 Changed 3 years ago by thomie

difficulty: Unknown
Type: bugtask
Type of failure: Building GHC failedNone/Unknown

The "horrible hack" is still there. This ticket is currently not listed on Status/SLPJ-Tickets.

comment:10 Changed 3 years ago by simonpj

I've added it to my list, because it does indeed need attention.

I think the right thing is to extract the information during the core-to-STG pass, and back-patch it into the interface-file info. The difficulty is really just ensuring that we don't thereby make space behaviour a lot worse by, in effect, having two copies of the program in memory at once.

I'd welcome help with doing this. Not hard, but needs a bit of care.

comment:11 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:12 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:13 Changed 22 months ago by thomie

Milestone: 8.0.1

comment:14 Changed 8 months ago by simonpj

Keywords: CodeGen added
Note: See TracTickets for help on using tickets.