Opened 4 years ago

Closed 4 years ago

#4229 closed bug (fixed)

relatively simple test case for "internal error: PAP object entered!" on GHC 6.12.3

Reported by: carlhowells Owned by:
Priority: high Milestone: 7.0.1
Component: Compiler Version: 6.12.3
Keywords: Cc: michal.terepeta@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By: #3983
Blocking: Related Tickets:

Description (last modified by igloo)

So, here's a test case

-- bug.cabal
Name:                bug
Version:             0.1
Build-type:          Simple
Cabal-version:       >=1.2

Executable bug
  Main-is: Bug.hs

  Build-depends:
    base > 4 && < 5,
    HUnit >= 1.2.2.1 && < 1.3,
    monads-fd >= 0.1 && < 0.2
-- Bug.hs
module Main where

import Control.Monad.Trans
import Control.Monad.State.Strict

import Test.HUnit

runMyTest :: StateT () IO a -> IO a
runMyTest x = evalStateT x ()

explode :: StateT () IO ()
explode = when ("" == "") . liftIO . assertFailure $ "X"

main :: IO Counts
main = runTestTT . TestCase . runMyTest $ explode

$ cabal build && ./dist/build/bug/bug
Preprocessing executables for bug-0.1...
Building bug-0.1...
[1 of 1] Compiling Main             ( Bug.hs, dist/build/bug/bug-tmp/Main.o )
Linking dist/build/bug/bug ...
Cases: 1  Tried: 0  Errors: 0  Failures: 0bug: internal error: PAP object entered!
    (GHC version 6.12.3 for x86_64_unknown_linux)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Aborted

I couldn't figure out how to get the error to happen with HUnit or a monad transformer. But here are some additional notes:

Compiling with -O0 fixes it.

Using mtl instead of monads-fd doesn't change anything.

Changing the ("" == "") to True results in not getting a GHC internal error, but the test run reports 0 failures, which is incorrect. Changing the import of Control.Monad.State.Strict to Control.Monad.State also results in no crash, but 0 failures reported.

None of these issues occurs in GHC 6.10.4. I haven't tested on versions other than 6.10.4 and 6.12.3.

Attachments (1)

tmp (6.8 KB) - added by lilac 4 years ago.
STG lint failure

Download all attachments as: .zip

Change History (9)

comment:1 Changed 4 years ago by carlhowells

Whoops, let me format that code properly.

-- Bug.hs
module Main where

import Control.Monad.Trans
import Control.Monad.State.Strict

import Test.HUnit

runMyTest :: StateT () IO a -> IO a
runMyTest x = evalStateT x ()

explode :: StateT () IO ()
explode = when ("" == "") . liftIO . assertFailure $ "X"

main :: IO Counts
main = runTestTT . TestCase . runMyTest $ explode

-- bug.cabal
Name:                bug
Version:             0.1
Build-type:          Simple
Cabal-version:       >=1.2

Executable bug
  Main-is: Bug.hs

  Build-depends:
    base > 4 && < 5,
    HUnit >= 1.2.2.1 && < 1.3,
    monads-fd >= 0.1 && < 0.2

comment:2 Changed 4 years ago by igloo

  • Description modified (diff)

comment:3 Changed 4 years ago by igloo

  • Milestone set to 6.14.1
  • Priority changed from normal to high

Thanks for the report

Changed 4 years ago by lilac

STG lint failure

comment:4 Changed 4 years ago by lilac

This also occurs on GHC version 6.12.1 for x86_64_unknown_linux, in case that helps narrow it down... The code passes core lint but fails STG lint.

comment:5 Changed 4 years ago by igloo

  • Blocked By 3983 added

comment:6 Changed 4 years ago by simonpj

  • Status changed from new to infoneeded

I believe I've fixed this: see #3959. Could you see if it works for you now?

Thanks

Simon

comment:7 Changed 4 years ago by michalt

  • Cc michal.terepeta@… added

It seems to work for me. All three cases: the default code, one with ("" == "")
changed to True and one with Lazy State monad, result in:

### Failure:
X
Cases: 1  Tried: 1  Errors: 0  Failures: 1

Tested with

The Glorious Glasgow Haskell Compilation System, version 7.1.20101015

comment:8 Changed 4 years ago by simonpj

  • Resolution set to fixed
  • Status changed from infoneeded to closed

Great. So I'll close the ticket. We have other tests for this.

Simon

Note: See TracTickets for help on using tickets.