#8762 closed bug (fixed)

Panic involving unboxed tuples and phantom types

Reported by: josef Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.8.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_compile/T8762
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I ran into a bug involving unboxed tuples and the following piece of code is an attempt at isolating the problem:

{-# LANGUAGE UnboxedTuples #-}
module Main where

type Ty a = Int

bug :: Ty a -> (# Ty a, () #)
bug ty = (# ty, () #)

main = do
  let (# a, b #) = bug undefined
  return ()

It seems that the phantom type is necessary to trigger the bug.

The bug is still present in 7.8rc1.

Change History (6)

comment:1 Changed 17 months ago by thoughtpolice

  • Version changed from 7.6.3 to 7.8.1-rc1

comment:2 Changed 17 months ago by thoughtpolice

  • Milestone set to 7.8.1

comment:3 Changed 17 months ago by goldfire

I just took a look at this and ended up in deeper waters within the type-checker than where I feel comfortable. But I did discover that the bug persists with

{-# LANGUAGE UnboxedTuples #-}
module Bug where

data Ty a = Int

bug :: () -> (# Ty a, () #)
bug _ = (# Int, () #)

main :: IO ()
main = do
  let (# a, b #) = bug ()
  return ()

Note that there is no undefined, and the previous type synonym Ty has now become a datatype.

comment:4 Changed 17 months ago by Simon Peyton Jones <simonpj@…>

In 47f473b0f7ddf21b2cde825166d092cb6e72329d/ghc:

Use NoGen plan for unboxed-tuple bindings

There was a small mixup here, exposed by Trac #8762.
Now clarified with better function names and comments.

comment:5 Changed 17 months ago by simonpj

  • Status changed from new to merge
  • Test Case set to typecheck/should_compile/T8762

Fixed, thank you.

Simon

comment:6 Changed 17 months ago by thoughtpolice

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

Merged.

Note: See TracTickets for help on using tickets.