Cheng Shao pushed to branch wip/ubsan at Glasgow Haskell Compiler / GHC Commits: d4b1e353 by Simon Hengel at 2025-12-10T00:00:02-05:00 Fix syntax error in gadt_syntax.rst - - - - - 91cc8be6 by Cheng Shao at 2025-12-10T00:00:43-05:00 ci: fix "ci.sh clean" to address frequent out of space error on windows runners This patch fixes the `ci.sh clean` logic to address frequent out of space error on windows runners; previously it didn't clean up the inplace mingw blobs, which is the largest source of space leak on windows runners. See added comment for detailed explanation. - - - - - fe2b79f4 by Recursion Ninja at 2025-12-10T08:34:18-05:00 Narrow before optimising MUL/DIV/REM into shifts The MUL/DIV/REM operations can be optimised into shifts when one of the operands is a constant power of 2. However, as literals in Cmm are stored as 'Integer', for this to be correct we first need to narrow the literal to the appropriate width before checking whether the literal is a power of 2. Fixes #25664 - - - - - 06c2349c by Recursion Ninja at 2025-12-10T08:34:58-05:00 Decouple 'Language.Haskell.Syntax.Type' from 'GHC.Utils.Panic' - Remove the *original* defintion of 'hsQTvExplicit' defined within 'Language.Haskell.Syntax.Type' - Redefine 'hsQTvExplicit' as 'hsq_explicit' specialized to 'GhcPass' exported by 'GHC.Utils.Panic' - Define 'hsQTvExplicitBinders' as 'hsq_explicit' specialized to 'DocNameI' exported by 'Haddock.GhcUtils'. - Replace all call sites of the original 'hsQTvExplicit' definition with either: 1. 'hsQTvExplicit' updated definition 2. 'hsQTvExplicitBinders' All call sites never entered the 'XLHsQTyVars' constructor branch, but a call to 'panic' existed on this code path because the type system was not strong enought to guarantee that the 'XLHsQTyVars' construction was impossible. These two specialized functions provide the type system with enough information to make that guarantee, and hence the dependancy on 'panic' can be removed. - - - - - ac0815d5 by sheaf at 2025-12-10T23:39:57-05:00 Quantify arg before mult in function arrows As noted in #23764, we expect quantification order to be left-to-right, so that in a type such as a %m -> b the inferred quantification order should be [a, m, b] and not [m, a, b]. This was addressed in commit d31fbf6c, but that commit failed to update some other functions such as GHC.Core.TyCo.FVs.tyCoFVsOfType. This affects Haddock, as whether we print an explicit forall or not depends on whether the inferred quantification order matches the actual quantification order. - - - - - 2caf796e by sheaf at 2025-12-10T23:39:57-05:00 Haddock: improvements to ty-var quantification This commit makes several improvements to how Haddock deals with the quantification of type variables: 1. In pattern synonyms, Haddock used to jumble up universal and existential quantification. That is now fixed, fixing #26252. Tested in the 'PatternSyns2' haddock-html test. 2. The logic for computing whether to use an explicit kind annotation for a type variable quantified in a forall was not even wrong. This commit improves the heuristic, but it will always remain an imperfect heuristic (lest we actually run kind inference again). In the future (#26271), we hope to avoid reliance on this heuristic. - - - - - b14bdd59 by Teo Camarasu at 2025-12-10T23:40:38-05:00 Add explicit export list to GHC.Num Let's make clear what this module exports to allow us to easily deprecate and remove some of these in the future. Resolves https://gitlab.haskell.org/ghc/ghc/-/issues/26625 - - - - - 64553a1c by Cheng Shao at 2025-12-11T15:10:41+01:00 configure: bump LlvmMaxVersion to 22 This commit bumps LlvmMaxVersion to 22; 21.x releases have been available since Aug 26th, 2025 and there's no regressions with 21.x so far. This bump is also required for updating fedora image to 43. - - - - - c89f17c6 by Cheng Shao at 2025-12-11T16:17:07+01:00 hadrian: add support for building with UndefinedBehaviorSanitizer This patch adds a +ubsan flavour transformer to hadrian to build all stage1+ C/C++ code with UndefinedBehaviorSanitizer. This is particularly useful to catch potential undefined behavior in the RTS codebase. - - - - - 97b60f92 by Cheng Shao at 2025-12-11T16:17:11+01:00 ci: update alpine/fedora & add ubsan job This patch updates alpine image to 3.23, fedora image to 43, and adds a `x86_64-linux-fedora43-validate+debug_info+ubsan` job that's run in validate/nightly pipelines to catch undefined behavior in the RTS codebase. - - - - - b65422e6 by Cheng Shao at 2025-12-11T16:17:11+01:00 rts: fix zero-length VLA undefined behavior in interpretBCO This commit fixes a zero-length VLA undefined behavior in interpretBCO, caught by UBSan: ``` +rts/Interpreter.c:3133:19: runtime variable length array bound evaluates to non-positive value 0 ``` - - - - - 993054b2 by Cheng Shao at 2025-12-11T16:17:11+01:00 rts: fix unaligned ReadSpB in interpretBCO This commit fixes unaligned ReadSpB in interpretBCO, caught by UBSan: ``` +rts/Interpreter.c:2174:64: runtime load of misaligned address 0x004202059dd1 for type 'StgWord', which requires 8 byte alignment ``` To perform proper unaligned read, we define StgUnalignedWord as a type alias of StgWord with aligned(1) attribute, and load StgUnalignedWord instead of StgWord in ReadSpB, so the C compiler is aware that we're not loading with natural alignment. - - - - - 8870995f by Cheng Shao at 2025-12-11T16:17:11+01:00 rts: fix signed integer overflow in subword arithmetic in interpretBCO This commit fixes signed integer overflow in subword arithmetic in interpretBCO, see added note for detailed explanation. - - - - - 42 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py - .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py - compiler/GHC/Cmm/Opt.hs - compiler/GHC/Core/TyCo/FVs.hs - compiler/GHC/Core/TyCo/Rep.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Tc/Utils/TcMType.hs - compiler/GHC/Tc/Utils/TcType.hs - compiler/Language/Haskell/Syntax/Type.hs - configure.ac - docs/users_guide/exts/gadt_syntax.rst - hadrian/doc/flavours.md - hadrian/src/Flavour.hs - libraries/base/src/GHC/Num.hs - + rts/.ubsan-suppressions - rts/Interpreter.c - rts/include/stg/Types.h - rts/rts.cabal - testsuite/driver/testglobals.py - testsuite/driver/testlib.py - + testsuite/tests/cmm/opt/T25664.hs - + testsuite/tests/cmm/opt/T25664.stdout - testsuite/tests/cmm/opt/all.T - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - testsuite/tests/interface-stability/base-exports.stdout-ws-32 - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Convert.hs - utils/haddock/haddock-api/src/Haddock/GhcUtils.hs - utils/haddock/html-test/ref/Bug1050.html - utils/haddock/html-test/ref/LinearTypes.html - utils/haddock/html-test/ref/PatternSyns.html - + utils/haddock/html-test/ref/PatternSyns2.html - utils/haddock/html-test/ref/TypeOperators.html - + utils/haddock/html-test/src/PatternSyns2.hs - utils/haddock/latex-test/ref/LinearTypes/LinearTypes.tex The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b59a2e2866821f617c3924f4ff4b840... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b59a2e2866821f617c3924f4ff4b840... You're receiving this email because of your account on gitlab.haskell.org.