Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#786 closed bug (fixed)

bugs around tagToEnum#

Reported by: Bulat.Ziganshin@… Owned by: simonpj
Priority: normal Milestone: 6.6
Component: Compiler Version: 6.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj)

i've enclosed 3 modules which reports various problems. all they use tagToEnum# and these bugs may be is because of the following, stated in CgExpr?.lhs:

          -- If you're reading this code in the attempt to figure
          -- out why the compiler panic'ed here, it is probably because
          -- you used tagToEnum# in a non-monomorphic setting, e.g., 
          --         intToTg :: Enum a => Int -> a ; intToTg (I# x#) = tagToEnum# x#
          -- That won't work.
        tycon = tyConAppTyCon res_ty

Attachments (3)

Unboxable.hs (123 bytes) - added by guest 8 years ago.
Unboxable2.hs (265 bytes) - added by guest 8 years ago.
Unboxable3.hs (218 bytes) - added by guest 8 years ago.

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by guest

Changed 8 years ago by guest

Changed 8 years ago by guest

comment:1 Changed 8 years ago by simonpj

  • Description modified (diff)

comment:2 Changed 8 years ago by simonpj

Unboxable.hs: we should fail more gracefully. Problem is that tagToEnum# is used at a polymorphic type:

ghc-6.4.2: panic! (the `impossible' happened, GHC version 6.4.2):
	splitTyConApp a{tv a17D}

Unboxable3.hs: Same, but this time tagToEnum# is used at Int, which isn't in Enum:

Unboxable3.o(.text+0x9): In function `s1tx_info':
: undefined reference to `GHCziBase_Int_closure_tbl'
collect2: ld returned 1 exit status

Unboxable2.hs: this is an NCG bug.

/tmp/ghc11494.s: Assembler messages:
/tmp/ghc11494.s:83: Error: junk `naughty I386 byte register' after expression
/tmp/ghc11494.s:83: Error: too many memory references for `mov'

comment:3 Changed 8 years ago by simonmar

Unboxable2.hs bug fixed.

comment:4 Changed 8 years ago by simonmar

  • Milestone set to 6.6
  • Owner set to simonpj

comment:5 Changed 8 years ago by simonpj

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

Unboxable.hs and Unboxable3.hs both fixed, by an ad-hoc change in TcExpr?.

Test is tcfail164.

comment:6 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:7 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.