Opened 10 years ago

Closed 10 years ago

Last modified 3 years ago

#1128 closed merge (fixed)

The impossible happened, code commented

Reported by: humasect Owned by:
Priority: lowest Milestone: 6.6.1
Component: Compiler Version: 6.6
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case: rn051
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

initializeWorld = (\w -> do
		worldSetGravity w 0 (-1.0) 0
		worldSetERP w 0.2
		worldSetCFM w 1e-5
		worldSetContactMaxCorrectingVel w 0.9
		worldSetContactSurfaceLayer w 0.001
		worldSetAutoDisableFlag w 1),

these worldSet* functions are unsafe FFI calls. initializeWorld is Ptr Int -> IO ()

commenting this prevents this bug. this code is found in a top level declaration:

initiailLevel = Level {
 ...
}

of which contains the record for initializeWorld

Attachments (2)

imp.tar.bz2 (4.3 KB) - added by humasect 10 years ago.
Contains standalone compilable demonstrating issues with the above, the "impossible bug" which seems to relate to rational literals, has spread further from logic recently.
ghc_trac_1128_imp2.tar.gz (4.7 KB) - added by thorkilnaur 10 years ago.
Modified imp.tar.bz2 that reproduces the problem for me

Download all attachments as: .zip

Change History (16)

comment:1 Changed 10 years ago by simonpj

  • Description modified (diff)

You need to give us a few more clues! For example, the error message you get.

But for this one we'll probably need to be able to reproduce your problem. Can you make a small program that demonstrates it? Thanks

Simon

comment:2 Changed 10 years ago by humasect

More clues found during investigation (use ODE library if needed):

foreign import ccall unsafe "dWorldSetContactSurfaceLayer" worldSetContactSurfaceLayer ::

WorldID -> Real -> IO ()

type WorldID = Int type Real = Double

initializeWorld = (\w -> do

--worldSetGravity w 0 (-1.0) 0 --worldSetERP w 0.2 --worldSetCFM w 1e-5 --worldSetContactMaxCorrectingVel w 0.9 worldSetContactSurfaceLayer w 0.001 ), --worldSetAutoDisableFlag w 1),

--- now here is the: --

ghc-6.6: panic! (the 'impossible' happened)

(GHC version 6.6 for i386-apple-darwin):

lookupDeprec base:GHC.Real.fromRational{v 01G}

-- Then change worldSetContactSurfaceLayer's second argument to 1.0 .... bug disappears.

I hope this helps

Changed 10 years ago by humasect

Contains standalone compilable demonstrating issues with the above, the "impossible bug" which seems to relate to rational literals, has spread further from logic recently.

comment:3 Changed 10 years ago by humasect

Confirmed to be caused by -fno-implicit-prelude when compiling this file (Level.hs in the attachment file) with ghc --make.

comment:4 Changed 10 years ago by simonpj

  • Test Case set to tcfail174
  • Type changed from bug to merge

This is a plain bug in the type checker. The program should clearly be rejected. I've fixed the bug.

MERGE to 6.6.1 branch

Tue Feb 6 16:54:56 GMT 2007 simonpj@…

  • Check for escape when unifying forall-types

Simon

comment:5 Changed 10 years ago by simonpj

  • Test Case tcfail174 deleted
  • Type changed from merge to bug

Bother. IGNORE my last comment; it was intended for a different bug entirely. Sorry.

Simon

comment:6 Changed 10 years ago by simonpj

I've just compiled the file you sent (on Unix) with GHC 6.6, thus:

  ghc --make -fno-implicit-prelude Level.hs

It worked fine. Can you help us reproduce this? Send the exact command line, and output you get. Pls start from a clean directory with precisely the download that you attached to this bug report.

Thanks

Simon

comment:7 Changed 10 years ago by igloo

  • Priority changed from normal to lowest
  • Summary changed from The impossible happened, code commented to [unreproducible] The impossible happened, code commented

I also can't reproduce this. Does anyone have any more info?

comment:8 Changed 10 years ago by thorkilnaur

  • Summary changed from [unreproducible] The impossible happened, code commented to The impossible happened, code commented

I attach ghc_trac_1128_imp2.tar.gz (a slightly modified imp.tar.bz2) that PPC Mac OS X 10.4 reacts to as follows:

Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base thorkilnaur$ gunzip ghc_trac_1128_imp2.tar.gz
Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base thorkilnaur$ mkdir verify
Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base thorkilnaur$ cd verify
Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base/verify thorkilnaur$ tar xvf ../ghc_trac_1128_imp2.tar
ghc_trac_1128_imp2/
ghc_trac_1128_imp2/cbits.c
ghc_trac_1128_imp2/Level.hs
ghc_trac_1128_imp2/Math.hs
ghc_trac_1128_imp2/ODE.hs
Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base/verify thorkilnaur$ diff ../imp/ ghc_trac_1128_imp2/
diff ../imp/Level.hs ghc_trac_1128_imp2/Level.hs
28a29,30
>       initializeWorld :: WorldID->IO (),
> 
45d46
< {-
53d53
< -}
Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base/verify thorkilnaur$ cd ghc_trac_1128_imp2
Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base/verify/ghc_trac_1128_imp2 thorkilnaur$ ghc --make -fno-implicit-prelude Level.hs
[1 of 3] Compiling ODE              ( ODE.hs, ODE.o )
[2 of 3] Compiling Math             ( Math.hs, Math.o )
[3 of 3] Compiling Level            ( Level.hs, Level.o )
ghc-6.7.20070209: panic! (the 'impossible' happened)
  (GHC version 6.7.20070209 for powerpc-apple-darwin):
        lookupDeprec base:GHC.Real.fromRational{v 01G}

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

Thorkil-Naurs-Computer:~/tn/GHC/trac/1128/base/verify/ghc_trac_1128_imp2 thorkilnaur$ 

This happens every time I try. So I have taken the liberty of removing the [unreproducible]-part of the summary.

Changed 10 years ago by thorkilnaur

Modified imp.tar.bz2 that reproduces the problem for me

comment:9 Changed 10 years ago by simonpj

  • Test Case set to rn051
  • Type changed from bug to merge

OK, I've nailed this one. Thank you for the bug report.

An easy workaround is to use -fno-warn-deprecations for this module.

Simon

comment:10 Changed 10 years ago by igloo

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

Merged.

comment:11 Changed 8 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:12 Changed 8 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:13 Changed 3 years ago by simonpj <simonpj@…>

In f0022b77de6b62a69f646d87ae84da1d476ca15f/ghc:

Add test for Trac #1128

comment:14 Changed 3 years ago by simonpj <simonpj@…>

Note: See TracTickets for help on using tickets.