diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-07-13 10:29:18 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-07-13 10:39:04 +0100 |
commit | d073c770209d3e7208059b3be8187a47c9181a3e (patch) | |
tree | 48f82ee71cf32c95de4904bab59b4476837a963f /testsuite/tests | |
parent | b935497756cb76964184ce5135a501116cde2c4c (diff) | |
download | haskell-d073c770209d3e7208059b3be8187a47c9181a3e.tar.gz |
Do not optimise RULE lhs in substRule
This was causing Trac #10627.
See Note [Substitute lazily] in CoreSubst.
The bug was introduced by
commit 30c17e7096919c55218083c8fcb98e6287552058
Author: simonpj@microsoft.com <unknown>
Date: Thu Nov 25 17:23:56 2010 +0000
Substitution should just substitute, not optimise
The fix is not to optimise the RHS as well as not-optimising the LHS!
The simplifier does the right thing in Simplify.simplRule
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T10627.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T10627.hs b/testsuite/tests/simplCore/should_compile/T10627.hs new file mode 100644 index 0000000000..6b4d73a17d --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T10627.hs @@ -0,0 +1,17 @@ +-- Made GHC 6.10.2 go into a loop in substRecBndrs +{-# OPTIONS_GHC -w #-} + +module T10627 where + +import Data.Word + +class C a where + splitFraction :: a -> (b,a) + +roundSimple :: (C a) => a -> b +roundSimple x = error "rik" + +{-# RULES + "rs" roundSimple = (fromIntegral :: Int -> Word) . roundSimple; + #-} + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 1ee56ec1fd..ec2a18a06c 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -213,3 +213,4 @@ test('T5821', only_ways(['optasm']), compile, ['']) test('T10176', only_ways(['optasm']), compile, ['']) test('T10180', only_ways(['optasm']), compile, ['']) test('T10602', only_ways(['optasm']), compile, ['-O2']) +test('T10627', only_ways(['optasm']), compile, ['']) |