Opened 8 years ago

Closed 8 years ago

#5742 closed bug (fixed)

compiler option -XDoRec crash

Reported by: Huenniger Owned by: simonpj
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 7.2.1
Keywords: frisby recusive do -XDoRec Cc: hunniger@…
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Compile-time crash Test Case: deSugar/should_run/T5742
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

I tried to compile a complex 200 KByte grammer using the library frisby. I got a linking error. The file is essentially one big "do rec" block and thus needs -XDoRec compiler option. I installed the latest GHC Version and use the minus -C flag to analyze the problem, which resulted in a ghc panic.

dirk@dirk-desktop:~/temp/wb2pdf/trunk/exp$ ghc  -C  -XDoRec Grammer.hs
addFlag by -C on the commandline:
    Warning: The -fvia-C flag does nothing; it will be removed in a future GHC release
ghc: panic! (the 'impossible' happened)
  (GHC version 7.2.2 for i386-unknown-linux):
	pipeLoop: at phase As but I wanted to stop at phase HCc

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

Attachments (1)

ticket.tar.gz (13.7 KB) - added by Huenniger 8 years ago.
Source Files that caused the problem

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by Huenniger

Attachment: ticket.tar.gz added

Source Files that caused the problem

comment:1 Changed 8 years ago by Huenniger

See attachment for the source file which caused the problem

comment:2 Changed 8 years ago by Huenniger

I could work around this problem by using mfix instead of do rec. The reason for the error seems to be

Grammer.hs:580:14:

A 570-tuple is too large for GHC

(max size is 62) Workaround: use nested tuples or define a data type

So yeah the do rec expression needs to be converted to a mfix expression and that needs a tuple with 580 elements which can not be used in ghc. Still what needs to be done is to give a proper error message in this case instead of just producing a linking error.

comment:3 Changed 8 years ago by igloo

Description: modified (diff)
difficulty: Unknown

comment:4 Changed 8 years ago by igloo

Milestone: 7.6.1

Thanks for the report

comment:5 Changed 8 years ago by simonpj

Owner: set to simonpj

I'm on this

comment:6 Changed 8 years ago by simonpj@…

commit bb50135b1c35fda5289c88dbcb6ed7fb936d92c0

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Tue Jan 17 16:40:03 2012 +0000

    Use nested tuples to desugar recursive do-notation
    
    Easy fix for Trac #5742.

 compiler/deSugar/DsExpr.lhs      |    8 ++++----
 compiler/typecheck/TcMatches.lhs |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

comment:7 Changed 8 years ago by simonpj

Status: newmerge
Test Case: deSugar/should_run/T5742

Thank you for reporting this. It was a stupid oversight, now fixed.

Ian: worth merging

Simon

comment:8 Changed 8 years ago by igloo

Milestone: 7.6.17.4.1
Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.