Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,334
    • Issues 4,334
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 368
    • Merge Requests 368
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #12520

Closed
Open
Opened Aug 22, 2016 by mniip@mniipReporter

Segfault when using unboxed tuples in GHCi

If you put this module in a package:

{-# LANGUAGE MagicHash, UnboxedTuples #-}

module Bug ( box, wrap, proxy ) where

import GHC.Prim

box :: (# Proxy# a, b #) -> b
box (# x, y #) = y

wrap :: b -> Proxy# a -> (# Proxy# a, b #)
wrap x = \i# -> (# i#, x #)

proxy :: () -> Proxy# a
proxy () = proxy#

Then in GHCi you can do:

GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Prelude> import Bug
Prelude Bug> box (wrap "foo" (proxy ()))
"Segmentation fault (core dumped)

Alternatively you can crash runhaskell if you put the above code in main.

It seems that GHCi fails to pickup usage of (# VoidRep, PtrLiftedRep #) tuples or something. The same trick works with State# in place of Proxy#, but not with Int#.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#12520