Magnus pushed to branch wip/mangoiv/bp-16719 at Glasgow Haskell Compiler / GHC Commits: 45a3ea31 by Phil Hazelden at 2026-10-26T16:52:30+01:00 Fix build with werror on glibc 2.43. We've been defining `_XOPEN_SOURCE` and `_POSIX_C_SOURCE` to the same values as defined in glibc prior to 2.43. But in 2.43, glibc changes them to new values, which means we get a warning when redefining them. By `#undef`ing them first, we no longer get a warning. Closes #27076. (cherry picked from commit 7b9a75f09a0a8d11d843f43e8e938b6608fb5166) - - - - - 8c1d9459 by mangoiv at 2026-10-28T17:24:07+01:00 fixup! Fix a few tag inference bugs. - - - - - 6a4afcb2 by Zubin Duggal at 2026-10-28T17:24:36+01:00 DmdAnal: Make AbsDmd neutral in maxDmd fixes #27845 (cherry picked from commit f76464cff4a9b55bb01e612bffe0dd866a9982e3) - - - - - 15 changed files: - + changelog.d/27845 - compiler/GHC/Types/Demand.hs - rts/include/rts/PosixSource.h - testsuite/tests/bytecode/T27001.stdout - testsuite/tests/bytecode/T27842.stdout - testsuite/tests/bytecode/all.T - + testsuite/tests/dmdanal/should_run/T27845.hs - + testsuite/tests/dmdanal/should_run/T27845.stdout - + testsuite/tests/dmdanal/should_run/T27845_Lib.hs - + testsuite/tests/dmdanal/should_run/T27845b.hs - + testsuite/tests/dmdanal/should_run/T27845b.stdout - + testsuite/tests/dmdanal/should_run/T27845b_Lib.hs - testsuite/tests/dmdanal/should_run/all.T - testsuite/tests/simplStg/should_run/T22042.stdout - testsuite/tests/simplStg/should_run/all.T Changes: ===================================== changelog.d/27845 ===================================== @@ -0,0 +1,5 @@ +section: compiler +synopsis: Fix a bug where an argument used lazily only by a function's stable + unfolding could be treated as strict in its fields. +mrs: !16746 +issues: #27845 ===================================== compiler/GHC/Types/Demand.hs ===================================== @@ -927,6 +927,8 @@ maxCard (Card a) (Card b) = Card ((a .&. b .&. 0b001) .|. ((a .|. b) .&. 0b110)) maxDmd :: Demand -> Demand -> Demand maxDmd BotDmd dmd2 = dmd2 maxDmd dmd1 BotDmd = dmd1 +maxDmd AbsDmd dmd2 = dmd2 +maxDmd dmd1 AbsDmd = dmd1 maxDmd (n1 :* sd1) (n2 :* sd2) = maxCard n1 n2 :* maxSubDmd sd1 sd2 ===================================== rts/include/rts/PosixSource.h ===================================== @@ -29,6 +29,8 @@ Oracle's Solaris 11 supports only up to XPG6, hence the ifdef. */ +#undef _POSIX_C_SOURCE +#undef _XOPEN_SOURCE #if defined(solaris2_HOST_OS) #define _POSIX_C_SOURCE 200112L #define _XOPEN_SOURCE 600 ===================================== testsuite/tests/bytecode/T27001.stdout ===================================== @@ -1,4 +1,4 @@ -(0.40 secs,) +(0.19 secs,) it :: () 100000.0 -(0.19 secs, 51,566,088 bytes) +(0.12 secs, 51,566,088 bytes) ===================================== testsuite/tests/bytecode/T27842.stdout ===================================== @@ -1,3 +1,6 @@ +(0.28 secs,) +it :: () 42 42 3 +(0.08 secs, 142,200 bytes) ===================================== testsuite/tests/bytecode/all.T ===================================== @@ -21,5 +21,5 @@ test('T27001', [extra_files(['T27001.hs']), req_interp], test('T27842', [extra_files(['T27842A.hs', 'T27842N.hs']), req_interp], run_command, ['{compiler} -e main -O -fno-unoptimized-core-for-interpreter ' - '-fobject-code -fbyte-code-and-object-code -fwrite-byte-code -fprefer-byte-code ' + '-fobject-code -fbyte-code-and-object-code -fprefer-byte-code ' 'T27842.hs']) ===================================== testsuite/tests/dmdanal/should_run/T27845.hs ===================================== @@ -0,0 +1,14 @@ +module Main where +import T27845_Lib (f) +import System.Environment (getArgs) + +{-# NOINLINE mkArg #-} +mkArg :: Int -> Int +mkArg n | n < 0 = n + | otherwise = error ("boom " ++ show n) + +main :: IO () +main = do + n <- length <$> getArgs + let x = mkArg n + print (length (f (x, x) n)) ===================================== testsuite/tests/dmdanal/should_run/T27845.stdout ===================================== @@ -0,0 +1 @@ +0 ===================================== testsuite/tests/dmdanal/should_run/T27845_Lib.hs ===================================== @@ -0,0 +1,11 @@ +module T27845_Lib where + +{-# INLINABLE [2] f #-} +f :: a -> Int -> [a] +f p x = lazyUse p x ++ lazyUse p (x + 1) ++ lazyUse p (x + 2) + +{-# NOINLINE lazyUse #-} +lazyUse :: a -> Int -> [a] +lazyUse p x = p `seq` replicate x p + +{-# RULES "lazyUse" [1] forall p x. lazyUse p x = [] #-} ===================================== testsuite/tests/dmdanal/should_run/T27845b.hs ===================================== @@ -0,0 +1,14 @@ +module Main where +import T27845b_Lib (outer) +import System.Environment (getArgs) + +{-# NOINLINE mkArg #-} +mkArg :: Int -> Int +mkArg n | n < 0 = n + | otherwise = error ("boom " ++ show n) + +main :: IO () +main = do + n <- length <$> getArgs + let x = mkArg n + print (length (outer (x, x) n)) ===================================== testsuite/tests/dmdanal/should_run/T27845b.stdout ===================================== @@ -0,0 +1 @@ +0 ===================================== testsuite/tests/dmdanal/should_run/T27845b_Lib.hs ===================================== @@ -0,0 +1,14 @@ +module T27845b_Lib where + +outer :: a -> Int -> [a] +outer a n = + let {-# INLINABLE [2] g #-} + g x = lazyUse a (x + 0) ++ lazyUse a (x + 1) ++ lazyUse a (x + 2) + in g n ++ g (n + 1) ++ g (n + 2) +{-# NOINLINE outer #-} + +{-# NOINLINE lazyUse #-} +lazyUse :: a -> Int -> [a] +lazyUse p x = p `seq` replicate x p + +{-# RULES "lazyUse" [1] forall p x. lazyUse p x = [] #-} ===================================== testsuite/tests/dmdanal/should_run/all.T ===================================== @@ -36,3 +36,5 @@ test('T23208', exit_code(1), multimod_compile_and_run, ['T23208_Lib', 'T23208']) test('T25439', normal, compile_and_run, ['']) test('T26416', [extra_files(['M1.hs'])], multimod_compile_and_run, ['T26416','M1.hs']) test('T27626', [extra_files(['M2.hs'])], multimod_compile_and_run, ['T27626','M2.hs']) +test('T27845', [extra_files(['T27845_Lib.hs'])], multimod_compile_and_run, ['T27845','T27845_Lib.hs']) +test('T27845b', [extra_files(['T27845b_Lib.hs'])], multimod_compile_and_run, ['T27845b','T27845b_Lib.hs']) ===================================== testsuite/tests/simplStg/should_run/T22042.stdout ===================================== @@ -1,4 +1,4 @@ -(0.30 secs,) +(0.11 secs,) it :: () ABC -(0.14 secs, 223,768 bytes) +(0.06 secs, 223,768 bytes) ===================================== testsuite/tests/simplStg/should_run/all.T ===================================== @@ -26,9 +26,6 @@ test('T22042', [extra_files(['T22042a.hs']),only_ways('normal'),unless(have_dyna # Depends on tag inference being similarly effective for bytecode which it is not yet. test('T23783', omit_ghci, multimod_compile_and_run, ['T23783', '-O -v0']) -# Requires UNPACK which needs -O -test('unpack_enum', omit_ways(['ghci']), compile_and_run, ['']) - # Tests that tag inference optimizes well, which is not the case for bytecode or # when we insert profiling ticks. test('T27005a', omit_ways(ghci_ways + prof_ways), compile_and_run, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/97e87e2963255c2771b10945d1fc322... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/97e87e2963255c2771b10945d1fc322... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help