[GHC] #14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14.

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Building and running the attached code results in the above error mesage. Enabling StaticPointers in the code makes the error go away. GHC should either reject the code or generate code that works properly at run-time, depending on the fine points of how TH is supposed to interact with StaticPointers. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by jchia): * Attachment "staticPointerBug.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jchia): This was reproduced under stack using nightly-2017-09-07. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by jchia): * failure: None/Unknown => Runtime crash -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by jchia: Old description:
Building and running the attached code results in the above error mesage. Enabling StaticPointers in the code makes the error go away.
GHC should either reject the code or generate code that works properly at run-time, depending on the fine points of how TH is supposed to interact with StaticPointers.
New description: Building and running the attached code results in the above crash error mesage. Enabling StaticPointers in the code makes the error go away. GHC should either reject the code or generate code that works properly at run-time, depending on the fine points of how TH is supposed to interact with the enablement of StaticPointers. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Here's a much more minimal example: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module Bug where import GHC.StaticPtr import Language.Haskell.TH main :: IO () main = putStrLn (deRefStaticPtr $(pure (StaticE (LitE (StringL "wat"))))) }}} I don't know too much about the subtleties of static pointers, but perhaps the simplest fix would be to add an extra check to see if `-XStaticPointers` is enabled before using them in Template Haskell? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Template Haskell | Version: 8.2.1 Resolution: | Keywords: | StaticPointers Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3931 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => StaticPointers * status: new => patch * differential: => Phab:D3931 * component: Compiler => Template Haskell Comment: With Phab:D3931, the attached program now fails with a sensible error message: {{{ staticPointerBug.hs:13:14: error: • Illegal static expression: static foo Use StaticPointers to enable this extension • In the untyped splice: $(cstatic 'foo) | 13 | let cl = $(cstatic 'foo) | ^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14.
-------------------------------------+-------------------------------------
Reporter: jchia | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Template Haskell | Version: 8.2.1
Resolution: | Keywords:
| StaticPointers
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3931
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#14204: GHC bug - makeStatic: Unresolved static form at line 13, column 14. -------------------------------------+------------------------------------- Reporter: jchia | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Template Haskell | Version: 8.2.1 Resolution: fixed | Keywords: | StaticPointers Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: th/T14204 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3931 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => th/T14204 * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14204#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC