From b3be0d185b6e597fa517859430cf6d54df04ca46 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Tue, 10 Jan 2023 09:26:08 +0000 Subject: Fix finaliseArgBoxities for OPAQUE function We never do worker wrapper for OPAQUE functions, so we must zap the unboxing info during strictness analysis. This patch fixes #22502 --- testsuite/tests/simplCore/should_compile/T22502.hs | 15 +++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 16 insertions(+) create mode 100644 testsuite/tests/simplCore/should_compile/T22502.hs (limited to 'testsuite/tests/simplCore') diff --git a/testsuite/tests/simplCore/should_compile/T22502.hs b/testsuite/tests/simplCore/should_compile/T22502.hs new file mode 100644 index 0000000000..396e4cab9f --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T22502.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE MagicHash #-} +module M where + +import GHC.Exts +import GHC.IO + +data T a = MkT !Bool !a + +fun :: T a -> IO a +{-# OPAQUE fun #-} +fun (MkT _ x) = IO $ \s -> noinline seq# x s +-- evaluate/seq# should not produce its own eval for x +-- since it is properly tagged (from a strict field) + +-- uses noinline to prevent caseRules from eliding the seq# in Core diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index e57bb4cafa..4fd57c5301 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -463,3 +463,4 @@ test('T22459', normal, compile, ['']) test('T22623', normal, multimod_compile, ['T22623', '-O -v0']) test('T22662', normal, compile, ['']) test('T22725', normal, compile, ['-O']) +test('T22502', normal, compile, ['-O']) -- cgit v1.2.1