Opened 7 years ago

Closed 7 years ago

#4255 closed bug (fixed)

Give a civilised error (not seg fault) when using TH in a profiled compiler

Reported by: simonpj Owned by: igloo
Priority: normal Milestone:
Component: Compiler Version: 6.12.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


If the compiler itself is compiled profiled, you can't use GHCi or Template Haskell. The former is checked, but the latter isn't. Instead if you use TH, the compiler seg-faults' see #4172.

Fix this!

Change History (2)

comment:1 Changed 7 years ago by simonpj

Owner: set to igloo

I think I've now done this

Mon Aug 23 14:33:53 BST 2010
  * The templateHaskellOk check should only run in stage2
  Because rtsIsProfiled is only available in stage2
Shall I push this patch? (1/2)  [ynW...], or ? for more options: y
Mon Aug 23 14:34:39 BST 2010
  * DPH should not even be built if GhcProfiled
  It's not just when cleaning!

Ian: can you add a test? (I'm not sure where to put it so that it'll run only when stage2 is profiled.) An example is

{-# LANGUAGE TemplateHaskell #-}
module Foo where

f x = $([| x |])

which now gives

simonpj@cam-04-unx:~/tmp$ ~/builds/HEAD-1/inplace/bin/ghc-stage2 -c T4255.hs
ghc-stage2: T4255.hs:1:14-28: You can't use Template Haskell with a profiled compiler
Usage: For basic information, try the `--help' option.


comment:2 Changed 7 years ago by igloo

Resolution: fixed
Status: newclosed

I've added the test, and fixed up various other things along the way.

The test will only be run if someone runs the testsuite with a profiled compiler, though, so I'm not sure how many regressions it will actually catch.

Note: See TracTickets for help on using tickets.