Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/0f9ae8ca840ca8290a56d638da29adc12ea48421 >--------------------------------------------------------------- commit 0f9ae8ca840ca8290a56d638da29adc12ea48421 Author: Simon Marlow <[email protected]> Date: Wed May 4 13:58:51 2011 +0100 add a test for #5149 The only way I could ticke this with a small program was to write it directly in .cmm (urgh). >--------------------------------------------------------------- tests/ghc-regress/codeGen/should_run/5149.hs | 8 +++++ .../should_run/5149.stdout} | 0 tests/ghc-regress/codeGen/should_run/5149_cmm.cmm | 29 ++++++++++++++++++++ tests/ghc-regress/codeGen/should_run/Makefile | 7 +++++ tests/ghc-regress/codeGen/should_run/all.T | 3 ++ 5 files changed, 47 insertions(+), 0 deletions(-) diff --git a/tests/ghc-regress/codeGen/should_run/5149.hs b/tests/ghc-regress/codeGen/should_run/5149.hs new file mode 100644 index 0000000..c0c88e3 --- /dev/null +++ b/tests/ghc-regress/codeGen/should_run/5149.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE MagicHash,GHCForeignImportPrim,UnliftedFFITypes #-} +module Main where + +import GHC.Exts + +foreign import prim "f5149" f :: Int# -> Int# -> Double# -> Int# + +main = print (I# (f 1# 2# 1.0##)) diff --git a/tests/ghc-regress/deriving/should_fail/drvfail016.stdout b/tests/ghc-regress/codeGen/should_run/5149.stdout similarity index 100% copy from tests/ghc-regress/deriving/should_fail/drvfail016.stdout copy to tests/ghc-regress/codeGen/should_run/5149.stdout diff --git a/tests/ghc-regress/codeGen/should_run/5149_cmm.cmm b/tests/ghc-regress/codeGen/should_run/5149_cmm.cmm new file mode 100644 index 0000000..b1e3dd6 --- /dev/null +++ b/tests/ghc-regress/codeGen/should_run/5149_cmm.cmm @@ -0,0 +1,29 @@ +#include "Cmm.h" + +/* This code is carefully arranged to tickle the bug reported in #5149 */ +f5149 +{ + D_ z; + + z = D1; + + W_ x,y; + x = R1; + y = R2; + + if (x > y) { + goto a; /* this jump is shortcutted to g5149 */ + } else { + goto b; + } + + a: + jump g5149; + b: + RET_N(TO_W_(%f2i32(z))); +} + +g5149 +{ + jump %ENTRY_CODE(Sp(0)); +} diff --git a/tests/ghc-regress/codeGen/should_run/Makefile b/tests/ghc-regress/codeGen/should_run/Makefile index 1c39d1c..ae69d81 100644 --- a/tests/ghc-regress/codeGen/should_run/Makefile +++ b/tests/ghc-regress/codeGen/should_run/Makefile @@ -1,3 +1,10 @@ TOP=../../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk + +.PHONY: 5149 +5149: + $(RM) 5149_cmm.o 5149.o 5149.hi 5149$(exeext) + $(TEST_HC) -v0 -O -c 5149_cmm.cmm + $(TEST_HC) -v0 --make -O 5149.hs 5149_cmm.o -o 5149$(exeext) + ./5149 diff --git a/tests/ghc-regress/codeGen/should_run/all.T b/tests/ghc-regress/codeGen/should_run/all.T index 394a1a1..1ba5529 100644 --- a/tests/ghc-regress/codeGen/should_run/all.T +++ b/tests/ghc-regress/codeGen/should_run/all.T @@ -84,3 +84,6 @@ test('3561', normal, compile_and_run, ['']) test('3677', extra_run_opts('+RTS -K8k -RTS'), compile_and_run, ['']) test('4441', normal, compile_and_run, ['']) +test('5149', [ extra_clean(['5149.o', '5149.hi', '5149_cmm.o', '5149']) ], + run_command, + ['$MAKE -s --no-print-directory 5149']) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
