Ticket #3313 (closed bug: duplicate)

Opened 4 years ago

Last modified 4 years ago

Uncertain bug report (panic!)

Reported by: semanticprecision Owned by:
Priority: normal Milestone: 6.12.1
Component: Compiler Version: 6.10.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Hi,

I really have no clue what happened; ghc panic!'d without much info, as far as I can tell. I've attached the files I've been working with.

In attempting :l imageloader in ghc, a panic! is achieved. That's about the extent of it. Everything was working fine (well, wan't compiling, but I ripped out the guts and was piecing it back together; but still, no crashing) until I changed the cast on line 26 of ImageLoader?.hs.

(I'm a Haskell n00b, hence the overtly inefficient and poorly-formatted code)

Attachments

ImageLoader.bug.zip Download (4.0 KB) - added by semanticprecision 4 years ago.
zip archive containing source to reproduce bug

Change History

Changed 4 years ago by semanticprecision

zip archive containing source to reproduce bug

in reply to: ↑ description ; follow-up: ↓ 2   Changed 4 years ago by semanticprecision

Additional info: Windows XP Home. Here's the actual error message:

Prelude Data.Word> :l imageloader
[1 of 5] Compiling ArrayMethods     ( ArrayMethods.hs, interpreted )
[2 of 5] Compiling Color            ( Color.hs, interpreted )
[3 of 5] Compiling Image            ( Image.hs, interpreted )
[4 of 5] Compiling GrayscalePNG     ( GrayscalePNG.hs, interpreted )
[5 of 5] Compiling ImageLoader      ( imageloader.hs, interpreted )
: panic! (the 'impossible' happened)
  (GHC version 6.10.3 for i386-unknown-mingw32):
        schemeE(AnnCase).my_discr __word 1

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

> :q
Leaving GHCi.

in reply to: ↑ 1   Changed 4 years ago by semanticprecision

Replying to semanticprecision: More more info: bug was fixed by replacing

bytesToGrayscaleImage bytes 1 dimensions = Just ( listToImage ( byteStringToPixels bytes 1 color1 ) dimensions )
bytesToGrayscaleImage bytes 2 dimensions = Just ( listToImage ( byteStringToPixels bytes 2 color2 ) dimensions )
bytesToGrayscaleImage bytes 3 dimensions = Just ( listToImage ( byteStringToPixels bytes 3 color3 ) dimensions )
bytesToGrayscaleImage bytes 4 dimensions = Just ( listToImage ( byteStringToPixels bytes 4 color4 ) dimensions )
bytesToGrayscaleImage _     _ _          = Nothing

with

bytesToGrayscaleImage bytes depth dimensions
	| depth == 1 = Just ( listToImage ( byteStringToPixels bytes 1 color1 ) dimensions )
	| depth == 2 = Just ( listToImage ( byteStringToPixels bytes 2 color2 ) dimensions )
	| depth == 3 = Just ( listToImage ( byteStringToPixels bytes 3 color3 ) dimensions )
	| depth == 4 = Just ( listToImage ( byteStringToPixels bytes 4 color4 ) dimensions )
	| otherwise  = Nothing

  Changed 4 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.12.1

Thanks for the report. It breaks the HEAD too.

Here's a minimal testcase:

module Foo where

import Data.Word

bytesToGrayscaleImage :: Word -> Maybe ()
bytesToGrayscaleImage 5 = Just ()
bytesToGrayscaleImage 6 = Just ()
bytesToGrayscaleImage _ = Nothing
$ ghci Foo.hs
GHCi, version 6.11.20090710: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp-0.1.0.0 ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Foo              ( Foo.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 6.11.20090710 for x86_64-unknown-linux):
        schemeE(AnnCase).my_discr __word 5

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

> 

  Changed 4 years ago by simonmar

  • status changed from new to closed
  • resolution set to duplicate

duplicate of #2881

Note: See TracTickets for help on using tickets.