Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: a18fa3c1 by Cheng Shao at 2026-03-14T05:12:14-04:00 configure: make $LLVMAS default to $CC when $CcLlvmBackend is YES This patch changes the $LLVMAS detection logic in configure so that when it's not manually specified by the user, it defaults to $CC if $CcLlvmBackend is YES. It's a more sensible default than auto-detected clang from the environment, especially when cross-compiling, $CC as the cross target's LLVM assembler is more compatible with the use case than the system-wide clang. Fixes #26769. - - - - - 3774086e by Matthew Pickering at 2026-03-14T05:13:00-04:00 exceptions: annotate onException continuation with WhileHandling Before this patch, an exception thrown in the `onException` handler would loose track of where the original exception was thrown. ``` import Control.Exception main :: IO () main = failingAction `onException` failingCleanup where failingAction = throwIO (ErrorCall "outer failure") failingCleanup = throwIO (ErrorCall "cleanup failure") ``` would report ``` T28399: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: cleanup failure HasCallStack backtrace: throwIO, called at T28399.hs:<line>:<column> in <package-id>:Main ``` notice that the "outer failure" exception is not present in the error message. With this patch, any exception thrown is in the handler is annotated with WhileHandling. The resulting message looks like ``` T28399: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: cleanup failure While handling outer failure HasCallStack backtrace: throwIO, called at T28399.hs:7:22 in main:Main ``` CLC Proposal: https://github.com/haskell/core-libraries-committee/issues/397 Fixes #26759 - - - - - 63ae8eb3 by Andreas Klebinger at 2026-03-14T05:13:43-04:00 Fix missing profiling header for origin_thunk frame. Fixes #27007 - - - - - 213d2c0e by Cheng Shao at 2026-03-14T05:14:28-04:00 ci: fix ci-images revision The current ci-images revision was a commit on the WIP branch of https://gitlab.haskell.org/ghc/ci-images/-/merge_requests/183, and it's not on the current ci-images master branch. This patch fixes the image revision to use the current tip of ci-images master. - - - - - fc2b083f by Andreas Klebinger at 2026-03-14T05:15:14-04:00 Revert "hadrian/build-cabal: Better respect and utilize -j" This reverts commit eab3dbba79650e6046efca79133b4c0a5257613d. While it's neat this currently isn't well supported on all platforms. It's time will come, but for now I'm reverting this to avoid issues for users on slightly unconvential platforms. This will be tracked at #26977. - - - - - 033185be by Cheng Shao at 2026-03-14T12:27:32-04:00 base: fix redundant imports in GHC.Internal.Weak.Finalize This patch fixes redundant imports in GHC.Internal.Weak.Finalize that causes a regression in bootstrapping head from 9.14 with validate flavours. Fixes #27026. - - - - - 8d578fdd by Matthew Pickering at 2026-03-14T12:27:33-04:00 Use explicit syntax rather than pure - - - - - 16 changed files: - .gitlab-ci.yml - .gitlab/generate-ci/gen_ci.hs - configure.ac - distrib/configure.ac.in - hadrian/build-cabal - libraries/base/changelog.md - libraries/base/src/GHC/Weak/Finalize.hs - libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs - libraries/ghc-internal/src/GHC/Internal/IO.hs - rts/StgMiscClosures.cmm - + testsuite/tests/exceptions/T26759.hs - + testsuite/tests/exceptions/T26759.stderr - + testsuite/tests/exceptions/T26759a.hs - + testsuite/tests/exceptions/T26759a.stderr - + testsuite/tests/exceptions/T26759a.stdout - testsuite/tests/exceptions/all.T Changes: ===================================== .gitlab-ci.yml ===================================== @@ -11,7 +11,7 @@ variables: GIT_SSL_NO_VERIFY: "1" # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: 4c3454a524436623df71b5faabd24e30b0f816d5 + DOCKER_REV: 5df428b97c501f61f57587048d4bd15eba53e364 # Sequential version number of all cached things. # Bump to invalidate GitLab CI cache. ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -173,7 +173,7 @@ configureArgsStr :: BuildConfig -> String configureArgsStr bc = unwords $ ["--enable-unregisterised"| unregisterised bc ] ++ ["--disable-tables-next-to-code" | not (tablesNextToCode bc) ] - ++ ["--with-intree-gmp" | Just _ <- pure (crossTarget bc) ] + ++ ["--with-intree-gmp" | Just _ <- [crossTarget bc] ] ++ ["--with-system-libffi" | crossTarget bc == Just "wasm32-wasi" ] ++ ["--enable-ipe-data-compression" | withZstd bc ] ++ ["--enable-strict-ghc-toolchain-check"] ===================================== configure.ac ===================================== @@ -542,9 +542,17 @@ FIND_LLVM_PROG([OPT], [opt], [$LlvmMinVersion], [$LlvmMaxVersion]) OptCmd="$OPT" AC_SUBST([OptCmd]) +dnl ** look to see if we have a C compiler using an llvm back end. +dnl +FP_CC_LLVM_BACKEND +AC_SUBST(CcLlvmBackend) + dnl ** Which LLVM assembler to use? dnl -------------------------------------------------------------- AC_ARG_VAR(LLVMAS,[Use as the path to LLVM's assembler (typically clang) [default=autodetect]]) +if test "x$CcLlvmBackend" = "xYES" && test -z "$LLVMAS"; then + LLVMAS="$CC" +fi FIND_LLVM_PROG([LLVMAS], [clang], [$LlvmMinVersion], [$LlvmMaxVersion]) LlvmAsCmd="$LLVMAS" AC_SUBST([LlvmAsCmd]) @@ -622,11 +630,6 @@ else AC_SUBST([NeedLibatomic],[NO]) fi -dnl ** look to see if we have a C compiler using an llvm back end. -dnl -FP_CC_LLVM_BACKEND -AC_SUBST(CcLlvmBackend) - FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS]) FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0]) FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1]) ===================================== distrib/configure.ac.in ===================================== @@ -203,9 +203,17 @@ FIND_LLVM_PROG([OPT], [opt], [$LlvmMinVersion], [$LlvmMaxVersion]) OptCmd="$OPT" AC_SUBST([OptCmd]) +dnl ** look to see if we have a C compiler using an llvm back end. +dnl +FP_CC_LLVM_BACKEND +AC_SUBST(CcLlvmBackend) + dnl ** Which LLVM assembler to use? dnl -------------------------------------------------------------- AC_ARG_VAR(LLVMAS,[Use as the path to LLVM's assembler (typically clang) [default=autodetect]]) +if test "x$CcLlvmBackend" = "xYES" && test -z "$LLVMAS"; then + LLVMAS="$CC" +fi FIND_LLVM_PROG([LLVMAS], [clang], [$LlvmMinVersion], [$LlvmMaxVersion]) LlvmAsCmd="$LLVMAS" AC_SUBST([LlvmAsCmd]) ===================================== hadrian/build-cabal ===================================== @@ -23,52 +23,9 @@ fi CABVERSTR=$("$CABAL" --numeric-version) CABVER=( ${CABVERSTR//./ } ) -THREADS="-j1" -GC_THREADS="" -SEMAPHORE="" - -echo "$@" - -# Try building hadrian in parallel. We check for -j<n>. -# If threads > 1 we pass --semaphore to allow ghc to build more than one module in parallel -# If threads > 4 we pass -qn as higher parallel gc thread counts can lead to slow downs -# We only do any of thise for cabal >= 3.14, because I don't trust older versions to handle --semaphore right -if [ "${CABVER[0]}" -gt 3 ] || [ "${CABVER[0]}" -eq 3 -a "${CABVER[1]}" -ge 14 ]; -then - - for arg in "$@"; do - case "$arg" in - -j) - GC_THREADS="-qn4" - SEMAPHORE="--semaphore" - THREADS="-j" - ;; - -j[0-9]*) - threads="${arg#-j}" - if [[ "$threads" =~ ^[0-9]+$ ]] && [ "$threads" -ne 0 ]; then - THREADS="-j${threads}" - if [ $threads -ge 4 ]; then - GC_THREADS="-qn4" - fi - if [ $threads -gt 1 ]; then - SEMAPHORE="--semaphore" - fi - fi - ;; - esac - - done - -fi - -if [ "$(uname -s)" = "FreeBSD" ]; then - # Can't rely on posix semaphore support in free bsd. - SEMAPHORE="" -fi - if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ]; then - "$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" ${THREADS} ${SEMAPHORE} --ghc-options="+RTS ${GC_THREADS} -RTS" exe:hadrian + "$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" -j exe:hadrian # use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH "$CABAL" --project-file="$PROJ" new-exec "${CABFLAGS[@]}" hadrian -- \ --directory "$PWD" \ ===================================== libraries/base/changelog.md ===================================== @@ -27,6 +27,7 @@ * Evaluate backtraces for "error" exceptions at the moment they are thrown. ([CLC proposal #383](https://github.com/haskell/core-libraries-committee/issues/383)) * Hide implementation details when throwing exceptions in throw and throwSTM. ([CLC proposal #387](https://github.com/haskell/core-libraries-committee/issues/387)) * Change `hIsReadable` and `hIsWritable` such that they always throw a respective exception when encountering a closed or semi-closed handle, not just in the case of a file handle. ([CLC proposal #371](github.com/haskell/core-libraries-committee/issues/371)) + * Annotate `onException` continuation with `WhileHandling`. ([CLC Proposal #397](https://github.com/haskell/core-libraries-committee/issues/397)) ## 4.22.0.0 *TBA* * Shipped with GHC 9.14.1 ===================================== libraries/base/src/GHC/Weak/Finalize.hs ===================================== @@ -16,12 +16,9 @@ import GHC.Internal.Weak.Finalize import GHC.Internal.Base import GHC.Internal.Exception -import GHC.Internal.IORef -import GHC.Internal.Conc.Sync (labelThreadByteArray#, myThreadId) -import GHC.Internal.IO (catchException, unsafePerformIO) +import GHC.Internal.IO (catchException) import GHC.Internal.IO.Handle.Types (Handle) import GHC.Internal.IO.Handle.Text (hPutStrLn) -import GHC.Internal.Encoding.UTF8 (utf8EncodeByteArray#) {-# DEPRECATED runFinalizerBatch ===================================== libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs ===================================== @@ -203,7 +203,7 @@ tryJust p a = catchJust p (Right `fmap` a) (return . Left) -- exception raised by the computation. onException :: IO a -> IO b -> IO a onException io what = io `catchNoPropagate` \e -> do - _ <- what + _ <- annotateIO (whileHandling e) what rethrowIO (e :: ExceptionWithContext SomeException) ----------------------------------------------------------------------------- ===================================== libraries/ghc-internal/src/GHC/Internal/IO.hs ===================================== @@ -52,7 +52,7 @@ module GHC.Internal.IO ( import GHC.Internal.Base import GHC.Internal.ST import GHC.Internal.Exception -import GHC.Internal.Exception.Type (NoBacktrace(..), WhileHandling(..), HasExceptionContext, ExceptionWithContext(..)) +import GHC.Internal.Exception.Type (NoBacktrace(..), whileHandling, WhileHandling(..), HasExceptionContext, ExceptionWithContext(..)) import GHC.Internal.Show import GHC.Internal.IO.Unsafe import GHC.Internal.Unsafe.Coerce ( unsafeCoerce ) @@ -363,7 +363,7 @@ getMaskingState = IO $ \s -> onException :: IO a -> IO b -> IO a onException io what = io `catchExceptionNoPropagate` \e -> do - _ <- what + _ <- annotateIO (whileHandling e) what rethrowIO (e :: ExceptionWithContext SomeException) -- | Executes an IO computation with asynchronous ===================================== rts/StgMiscClosures.cmm ===================================== @@ -47,6 +47,7 @@ import CLOSURE stg_ret_v_info; /* See Note [Original thunk info table frames] in GHC.StgToCmm.Bind. */ INFO_TABLE_RET (stg_orig_thunk_info_frame, RET_SMALL, W_ info_ptr, + PROF_HDR_FIELDS(W_, p1, p2) W_ thunk_info_ptr) /* no args => explicit stack */ { ===================================== testsuite/tests/exceptions/T26759.hs ===================================== @@ -0,0 +1,10 @@ +import Control.Exception + +run :: IO () +run = failingAction `onException` failingCleanup + where + failingAction = throwIO (ErrorCall "outer failure") + failingCleanup = throwIO (ErrorCall "cleanup failure") + +main :: IO () +main = run ===================================== testsuite/tests/exceptions/T26759.stderr ===================================== @@ -0,0 +1,9 @@ +T26759: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: + +cleanup failure + +While handling outer failure + +HasCallStack backtrace: + throwIO, called at T26759.hs:7:22 in main:Main + ===================================== testsuite/tests/exceptions/T26759a.hs ===================================== @@ -0,0 +1,10 @@ +import Control.Exception + +run :: IO () +run = failingAction `onException` cleanup + where + failingAction = throwIO (ErrorCall "outer failure") + cleanup = putStrLn "cleanup" + +main :: IO () +main = run ===================================== testsuite/tests/exceptions/T26759a.stderr ===================================== @@ -0,0 +1,7 @@ +T26759a: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall: + +outer failure + +HasCallStack backtrace: + throwIO, called at T26759a.hs:6:21 in main:Main + ===================================== testsuite/tests/exceptions/T26759a.stdout ===================================== @@ -0,0 +1 @@ +cleanup ===================================== testsuite/tests/exceptions/all.T ===================================== @@ -1,2 +1,3 @@ test('T25052', normal, compile_and_run, ['']) - +test('T26759', exit_code(1), compile_and_run, ['']) +test('T26759a', exit_code(1), compile_and_run, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6a4c0dccfc7ec838323be03325c1867... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6a4c0dccfc7ec838323be03325c1867... You're receiving this email because of your account on gitlab.haskell.org.