
#15617: Unboxed tuples/sum error message on `a = show 5` in expression evaluation and interactive modes -------------------------------------+------------------------------------- Reporter: ChaiTRex | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.6.1-beta1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by ChaiTRex: Old description:
With GHC 8.4.3 (`ghc` below on both Ubuntu 16.04.5 and Ubuntu 18.04.1) and recent GHC (`~/dev/ghc/inplace/bin/ghc-stage2` below on Ubuntu 16.04.5; not `HEAD` but close at `ff29fc84c03c800cfa04c2a00eb8edf6fa5f4183`), I get errors for `a = show 5`.
I run the following commands, showing that `show 5` is usually fine:
{{{ $ ghc -fobject-code -O2 -e 'show 5' "5"
$ ghc -fobject-code -O2 -e 'let a = show 5 in a' "5" }}}
But not with `a = show 5`:
{{{ $ ghc -fobject-code -O2 -e 'a = show 5' <interactive>: Error: bytecode compiler can't handle unboxed tuples and sums. Possibly due to foreign import/export decls in source. Workaround: use -fobject-code, or compile this module to .o separately. }}}
Running with `ghci` gives the same error:
{{{ $ ghci -fobject-code -O2 GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Prelude> a = show 5 Error: bytecode compiler can't handle unboxed tuples and sums. Possibly due to foreign import/export decls in source. Workaround: use -fobject-code, or compile this module to .o separately. Prelude> Leaving GHCi. }}}
Both errors stop when optimization is turned off:
{{{ $ ghc -fobject-code -O0 -e 'a = show 5'
$ ghci -fobject-code -O0 GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Prelude> a = show 5 Prelude> Leaving GHCi. }}}
New description: With GHC 8.4.3 (on both Ubuntu 16.04.5 and Ubuntu 18.04.1) and recent GHC (not `HEAD` but close at `ff29fc84c03c800cfa04c2a00eb8edf6fa5f4183` on Ubuntu 16.04.5), I get errors for `a = show 5`. I run the following commands, showing that `show 5` is usually fine: {{{ $ ghc -fobject-code -O2 -e 'show 5' "5" $ ghc -fobject-code -O2 -e 'let a = show 5 in a' "5" }}} But not with `a = show 5`: {{{ $ ghc -fobject-code -O2 -e 'a = show 5' <interactive>: Error: bytecode compiler can't handle unboxed tuples and sums. Possibly due to foreign import/export decls in source. Workaround: use -fobject-code, or compile this module to .o separately. }}} Running with `ghci` gives the same error: {{{ $ ghci -fobject-code -O2 GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Prelude> a = show 5 Error: bytecode compiler can't handle unboxed tuples and sums. Possibly due to foreign import/export decls in source. Workaround: use -fobject-code, or compile this module to .o separately. Prelude> Leaving GHCi. }}} Both errors stop when optimization is turned off: {{{ $ ghc -fobject-code -O0 -e 'a = show 5' $ ghci -fobject-code -O0 GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Prelude> a = show 5 Prelude> Leaving GHCi. }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15617#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler