Opened 4 years ago

Closed 4 years ago

#4345 closed bug (fixed)

Compiler crash building regex-posix version 0.94.1 using ghc 7.0.1-rc1

Reported by: dsf Owned by: simonpj
Priority: highest Milestone: 7.0.1
Component: Compiler Version: 7.1
Keywords: Cc: ganesh, HoseinAttarzadeh
Operating System: Linux Architecture: x86
Type of failure: Compile-time crash Difficulty:
Test Case: simplCore/should_compile/T4345 Blocked By:
Blocking: Related Tickets:

Description

Building regex-posix-0.94.1...
[1 of 6] Compiling Text.Regex.Posix.Wrap ( dist-ghc6/build/Text/Regex/Posix/Wrap.hs, dist-ghc6/build/Text/Regex/Posix/Wrap.o )
SpecConstr
    Function `lvl_s2Ay{v} [lid]'
      has three call patterns, but the limit is 0
    Use -fspec-constr-count=n to set the bound
    Use -dppr-debug to see specialisations
ghc: panic! (the 'impossible' happened)
  (GHC version 7.0.0 for i386-unknown-linux):
	initC: srt_lbl

Attachments (2)

log.gz (40.7 KB) - added by simonmar 4 years ago.
-dverbose-core2core -dcore-lint log
Wrap.hs (6.0 KB) - added by igloo 4 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 4 years ago by dsf

This problem persists in regex-posix-0.94.4. It seems to be caused by the line

Just (whole:_) -> loop (succ acc) pos whole

in Text.Regex.Posix.Wrap.wrapCount.

comment:2 Changed 4 years ago by ganesh

  • Cc ganesh added

comment:3 Changed 4 years ago by ganesh

  • Cc ganesh removed

comment:4 Changed 4 years ago by ganesh

  • Cc ganesh added

comment:5 Changed 4 years ago by dsf

This bug is a blocker for us, we have suspended testing of 7.0.1 rc1.

comment:6 Changed 4 years ago by igloo

  • Milestone set to 7.0.1
  • Priority changed from normal to highest

comment:7 Changed 4 years ago by simonmar

There's a Core Lint error after the first simplification pass; I've attached a log from -dverbose-core2core -dcore-lint in case this helps Simon track down the problem (he was having trouble repro'ing because regex-posix doesn't build on Windows, which is a different problem).

Changed 4 years ago by simonmar

-dverbose-core2core -dcore-lint log

Changed 4 years ago by igloo

comment:8 Changed 4 years ago by igloo

  • Owner set to simonpj

Standalone testcase attached.

$ ghc -c Wrap.hs -O   
ghc: panic! (the 'impossible' happened)
  (GHC version 7.0.0.20100924 for x86_64-unknown-linux):
        initC: srt_lbl

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

comment:9 Changed 4 years ago by simonpj

Thanks for the test case! I've boiled it down a lot more.

module Wrap where

isNull :: IO Bool
isNull = error "urk"

wrapMatchAll :: IO (Maybe ())
wrapMatchAll = do
  nsub <- undefined
  let loop True = do atEnd <- isNull 
                     return Nothing
      loop False = loop False 
  result <- undefined
  loop undefined

It's a bug in the mighty simplifier. I'm on it.

Simon

comment:10 Changed 4 years ago by HoseinAttarzadeh

  • Cc HoseinAttarzadeh added

comment:11 Changed 4 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to simplCore/should_compile/T4345

Done. Fixed by

Thu Oct  7 03:27:20 PDT 2010  simonpj@microsoft.com
  * Fix Trac #4345: simplifier bug
  
  This is another long-standing bug, in which there was a possibility
  that a loop-breaker could lose its loop-breaker-hood OccInfo, 
  and then the simplifer re-simplified the expression. Result, either
  non-termination or, in the case of #4345, an unbound identifier.
  
  The fix is very simple, in Id.transferPolyIdInfo. 
  See Note [transferPolyIdInfo].

    M ./compiler/basicTypes/Id.lhs -8 +25

comment:12 Changed 4 years ago by simonmar

  • Status changed from closed to merge

comment:13 Changed 4 years ago by dsf

Build of regex-posix now succeeds with this patch.

comment:14 Changed 4 years ago by igloo

  • Status changed from merge to closed

Merged.

Note: See TracTickets for help on using tickets.