-
c77b77e7
by Simon Hengel at 2026-07-15T16:39:36+05:30
Refactor GHC.Driver.Errors.printMessages
(cherry picked from commit 49a44ab79d644590abdeff8699406bbd2d310715)
-
704f7368
by Simon Hengel at 2026-07-15T16:40:59+05:30
Include the rendered message in -fdiagnostics-as-json output
This implements #26173.
(cherry picked from commit d046b5ab146167bcb86c675d101ff5e3c4eb8c8e)
-
6850cb8f
by fendor at 2026-07-15T16:41:10+05:30
Revert prog003 acceptance
We thought the commit 286f1adff3e78d775ff325caff71d0cee25d710b fixed the
test, but due to changes to ghci, modules loaded during the GHCi
session, the test was actually no longer testing what it set out to do,
"fixing" the broken test.
As modules are added to the `interactive-session` home unit, the object code needs
to be compiled with `-this-unit-id interactive-session`, otherwise the
object code won't be used.
Once this has been fixed in the test, the test fails as expected again.
(cherry picked from commit 8f9917557a7ef290dfa8b913c3a4146289586ec6)
-
41ecaadd
by sheaf at 2026-07-15T16:44:19+05:30
Fix AArch64 clobbering bug for MUL2
On AArch64, the code generator could clobber one of the input operands
when computing the lower bits of a MUL2 operation. This rendered invalid
the subsequent computation of the high bits.
This commit fixes that by using a temporary register. The register
allocator can remove the redundant move in the common case when the
registers do not conflict.
Fixes #27046
(cherry picked from commit c9015f0953e72829e89ac768b6ad9ece34c7e187)
-
985b0e36
by mangoiv at 2026-07-15T16:44:19+05:30
libraries/process: bump submodule to v1.6.30.0
- bump the submodule to the appropriate tag
- suppress benign warning resulting from the change
(cherry picked from commit d9ea2d76545452a7df567b162340079cb024a40c)
-
16e9f578
by ARATA Mizuki at 2026-07-15T16:44:19+05:30
RISC-V NCG: Zero-extend the result of castFloatToWord32
According to the ISA manual, FMV.X.W sign-extends the result.
We need to truncate the result to avoid creating an exotic Word32 value.
Fixes #27300
(cherry picked from commit 291ce3aafe4ca3d2562154a28c595a858987d9f1)
-
c16871c9
by ARATA Mizuki at 2026-07-15T16:44:19+05:30
RISC-V NCG: Treat d28-d31 (ft8-ft11) as caller-saved
According to the calling convention, the registers d28-d31 (ft8-ft11) are caller-saved.
Fixes #27306
(cherry picked from commit 011be91fdaa7869dff2f30b8f2ecca3c9a713739)
-
d8f0999a
by ARATA Mizuki at 2026-07-15T16:44:20+05:30
RISC-V NCG: Set rounding mode when emitting `truncate`
If we omit the rounding mode for `fcvt`, `dyn` will be used.
We do not want that for `truncate`, so we set `rtz`.
In other places, we set `rne` because we do not use the dynamic rounding mode.
Fixes #27303
(cherry picked from commit e8a547133031b7de8f6f9bbd70a7148eda0941ee)
-
bfcd8dfc
by Zubin Duggal at 2026-07-15T16:44:20+05:30
rts: fix validate build with gcc 16. `__attribute__((regparm(1)))` is ignored on x86_64 and now
gcc warns that it is ignored:
rts/sm/Evac.h:35:1: error:
error: ‘regparm’ attribute ignored [-Werror=attributes]
See https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ccead81bbc39668376eb5cf47066acb446cc43f3
Fixes #27366
(cherry picked from commit 9438bec7117433bbc70449d4288f6ee32dbbbec4)
-
275a0382
by Ian Duncan at 2026-07-15T16:44:54+05:30
AArch64: use SXTH, not SXTW, for W32 signExtendReg
signExtendReg was using SXTH (sign-extend halfword, 16-bit) for
W32-to-W64 sign extension. This should be SXTW (sign-extend word,
32-bit). SXTH only sign-extends the lower 16 bits, producing wrong
results for 32-bit values whose bit 15 differs from bit 31.
Other fixes:
- At sub-W64, code gen for MO_S_Mul2 should use W32 registers for
SMULL source operands as per the ARM spec (SMULL Xd, Wn, Wm),
and not W64.
- Ensure signExtendReg uses the source width for the source operand
in SXTW/SXTH/SXTB instructions. GNU as requires sxtw Xd,Wn (not
sxtw Xd,Xn), while LLVM's integrated assembler on macOS is lenient.
- Fix overflow flag computation for `MO_S_Mul2`. The overflow bit
was exactly inverted for sub-W64 operands.
Fixes #26978 and #27047
(cherry picked from commit 636c1c7ae47495f022affa501ea0a40cb55cd4a4)
-
dec52356
by Luite Stegeman at 2026-07-15T16:46:04+05:30
tag inference: don't confuse functions with their return values
inferTagRhs was mixing up taggedness for closures and return values
for function closures. We really shouldn't assign TagTuple to a
properly tagged function returning a tuple.
We fix this by keeping track of functions (TagFun) separately from
values (TagVal) and keeping track of their return value. TagFun is
also used for join points.
fixes #27005
(cherry picked from commit 7fe4f2ec3ce12ea138177c81a019dcfc148fe5d4)
-
a40f21b5
by Sebastian Graf at 2026-07-15T16:47:03+05:30
Desugar a `case` scrutinee only once (#27383, #20251)
In `dsExpr` for `HsCase` we desugared the scrutinee /twice/: once to
build the Core `case` itself, and again inside `matchWrapper`, which
re-desugared the source scrutinee (via `addHsScrutTmCs`) purely to
record long-distance information for the pattern-match checker.
For a single `case` that is merely wasteful. But for nested cases it
is catastrophic. Consider
case (case (case e of ... ) of ... ) of ...
Desugaring the outer scrutinee desugars the middle `case` twice, each
of which desugars the inner `case` twice, and so on. The work doubles
at every level, so desugaring takes O(2^n) time in the nesting depth.
That is the blowup reported in #27383; it is also what makes the
machine-generated program in #20251 take an age to compile.
The fix is simple. `matchWrapper` is handed the scrutinee anyway, so
we give it the Core expression we have /already/ desugared, and record
the long-distance term constraint with `addCoreScrutTmCs` instead of
re-desugaring from source. This is just what `matchSinglePatVar`
already does for single-pattern matches.
So:
* `matchWrapper` now takes `Maybe [CoreExpr]` rather than
`Maybe [LHsExpr GhcTc]`.
* The `HsCase` equation of `dsExpr` passes the already-desugared
`core_discrim`; the arrow desugarer passes its match variables.
* `addHsScrutTmCs` had no other use, so it is gone.
Desugaring is now linear in the nesting depth. (The coverage checker
still runs `simpleOptExpr` over each scrutinee, which leaves the total
at O(n^2); that is ample.) The long-distance information itself is
unchanged: the checker sees precisely the Core that backs the
generated code.
Test: deSugar/should_compile/T27383
(cherry picked from commit 67d41299be96798702377e6e2b826f9c8e070821)
-
46dfc982
by mangoiv at 2026-07-15T16:48:09+05:30
ExplicitLevelImports: check staging for types just like for values
Previously, imported types were entirely exempted from staging checks as
the implicit stage persistance assumed to be all imported types to be
well staged. ExplicitLevelImports' change specification, however, does
not do such an exemption. Thus we want to introduce such a check, just
like we have for values.
ExplicitLevelImports does not, however, talk about local names - from
its perspective, we could theoretically keep treating locally introduced
types specially - e.g. an ill-staged used in a quote would only emit a
warning, not an error. To allow for a potential future migration away
from such wrinkles as the staging check in notFound
(see Note [Out of scope might be a staging error]) we consistently do
the strict staging check that we also do for value if ExplicitLevelImports
is on.
Closes #26098
(cherry picked from commit c64cca1ef667751c02ce2eb4141349e601aac99c)
-
41ff5cd7
by Simon Hengel at 2026-07-15T16:48:47+05:30
Reference correct package in error messages for reexported modules
(fixes #27417)
(cherry picked from commit a805b2a25021606b30d250e084d4beecbfac0d0a)
-
0088aeb5
by Luite Stegeman at 2026-07-15T16:49:09+05:30
rts: handle large AP closures in compacting GC
The function update_fwd_large in the compacting GC could run into
an unexpected object with the following error:
internal error: update_fwd_large: unknown/strange object 24
Closure type 24 is the AP closure, which was not handled in
upd_fwd_large. This patch adds handling them.
fixes #27434
(cherry picked from commit cca0d58963f802a8b2e43aa2dbc58592f8ad07bb)
-
3bbf347b
by Cheng Shao at 2026-07-15T16:49:09+05:30
compiler: fix missing handling of CmmUnsafeForeignCall node in LayoutStack
This patch fixes missing handling of `CmmUnsafeForeignCall` middle
node in the `LayoutStack` pass.
Before proc-points splitting, this pass computes liveliness of local
registers, and spills those alive across a Cmm native call onto the
stack. It need to traverse all middle nodes in each block and check
whether a local register is an assignee, if so then the previous
mapping in `sm_regs` is invalidated and needs to be dropped. However,
it didn't handle `CmmUnsafeForeignCall` node which may also assign to
a local register. When proc-points splitting is enabled, this can
produce an invalid basic block that doesn't properly backup the
updated local register to the stack before doing a Cmm call, resulting
in completely invalid runtime behavior.
The patch also adds a `T27447` regression test. With no-TNTC or with
LLVM backend, without the fix the test case would output a stale
0x1111111111111111 value, instead of the expected 0x2222222222222222
output.
Fixes #27447.
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit 3f00f234d0d5b3b3b2a23a5dc70ce372eb9bbdb4)
-
06fcc414
by Cheng Shao at 2026-07-15T16:49:09+05:30
ci: use treeless fetch for perf notes
This patch improves the ci logic for fetching perf notes by using
treeless fetch
(https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone),
to avoid downloading all blobs of the perf notes repo at once, and
only fetch the actually required blobs on-demand when needed. This
makes the initial `test-metrics.sh pull` operation much faster, and
also more robust, since we are seeing an increasing rate of 504 errors
in CI when fetching all perf notes at once, which is a major source of
CI flakiness at this point.
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit 3c0013778b4459c1f8e56cd0dc2600f5bb3769d2)
-
feaa0f47
by mangoiv at 2026-07-15T16:49:09+05:30
ci: retry fetching test metrics
Retry fetching test metrics to make the CI not fail if the services is
temporarily unavailable
(cherry picked from commit b7e24044fde064cb3f0d44c36872a86d024cd7d4)
-
c19af18a
by Zubin Duggal at 2026-07-15T16:49:09+05:30
Bump semaphore-compat submodule to 2.0.1
This versions includes some cruicial fixes for darwin
(cherry picked from commit 4180af3f71754472dbd49b85179b25fd29bd9998)
-
4e296572
by Zubin Duggal at 2026-07-15T16:49:09+05:30
CorePrep: Don't speculatively evaluate bindings that we have already discovered to be absent
In #25924, we segfault because speculation forces a projection out of a RUBBISH dictionary
(which we generated because it absent).
Solution: Don't speculate on bindings we already know are absent.
Fixes 25924
(cherry picked from commit 9b714c4c833461c621f0a050680848d7248aa57e)
-
25026e53
by Zubin Duggal at 2026-07-15T16:49:55+05:30
Don't make absent fillers for terminating types
In #25924 we discovered that we could speculatively evaluate an absent filler
for a dictionary, and project a field (a superclass selector) out of it,
resulting in segfaults.
Solution: Never make an absent filler or rubbish literal for a terminating type
like a dictionary. mkAbsentFiller returns Nothing for isTerminatingType, so
worker/wrapper and the specialiser keep the real argument instead.
Some small metric decreases because we do a little less work in the
simplifier now.
Metric Decrease:
T9872a
T9872b
T9872c
TcPlugin_RewritePerf
(cherry picked from commit 4a59b3eece9b7106fcbe73d2d06a49755be4ea8f)
-
588765fd
by Andreas Klebinger at 2026-07-15T16:50:45+05:30
Fix a profiling race condition resulting in segfaults.
StgToCmm: Don't assume tagged FUN closures in closureCodeBody.
When entering a closure the self/node pointer might not be tagged in
some situations when a thunk is evaluated by multiple threads.
So we most AND away the tag bits rather than subtracting an expected tag.
Apply.cmm: Fix a race condition occuring when a thunk is mutated during GC.
In stg_ap_0_fast when might need to run GC before entering a thunk. If this happens
another thread or the GC itself might mutate the closure making entering it no longer
valid. We now check for this.
Add test and changelog for #27123 fixes.
(cherry picked from commit ed09895d7de1ca116a561868c151fd825a16ad0c)
-
e86a5193
by Cheng Shao at 2026-07-15T16:50:45+05:30
ghc-heap: fix invalid srtlen returned by peekItbl when no-TNTC
This patch fixes the no-TNTC code path of `peekItbl` so that it looks
at the right memory address when reading the `srt` field from the
`StgInfoTable_` struct. Also adds a `T27465` regression test that
reproduces the bug on no-TNTC builds before the fix. Fixes #27465.
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit 67c03eb2c762fdfeb646eb8345341173dd4268b2)
-
c603d701
by Cheng Shao at 2026-07-15T16:50:45+05:30
compiler: fix miscompiled %load_relaxed, add missing %store_relaxed
This patch fixes the %load_relaxed cmm primop compilation logic to
correctly use relaxed memory ordering, and adds the missing
%store_relaxed primop. Parsing logic of %load/%store with explicit
ordering is covered in the AtomicFetch test case. Fixes #27483.
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit eee8ec5b25ef0f83ba4822e7a0a941df7b0bec5f)
-
acc488d1
by Cheng Shao at 2026-07-15T16:50:45+05:30
rts: fix missing UNTAG in stg_readTVarIOzh
This patch fixes missing UNTAG on the current value closure read from
StgTVar. UNTAG is a no-op when it's stg_TREC_HEADER_info which is word
aligned; it may be a tagged closure, and reading info table from the
tagged address is an unaligned load which may cause issues on
platforms with strict alignment requirements.
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit d377e83e51d39a06e1f0bf2e35a923a3210b21a2)
-
4c16d073
by Cheng Shao at 2026-07-15T16:50:46+05:30
rts: fix missing UNTAG in stg_control0zh_ll
This patch fixes missing UNTAG on the cont closure returned by
captureContinuationAndAbort. In case it's not NULL,
captureContinuationAndAbort returns a tagged StgContinuation closure,
in which case it must be untagged before accessing the
apply_mask_frame field.
In the past it worked out of luck: when apply_mask_frame was NULL then
mask_frame_offset is also 0 so the control flow didn't diverge to a
wrong path. Still, this is horribly wrong and will crash once
StgContinuation struct is refactored and fields are shuffled around.
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit 8ed038421a20e3e4e681973b2f5098e5bd2144b5)
-
0906c7dc
by Cheng Shao at 2026-07-15T16:50:46+05:30
compiler: fix redundant AP thunk codegen when not using -ticky-ap-thunk
This patch fixes a double negation confusion in !7525 that results in
some redundant AP thunk code generation when not using
-ticky-ap-thunk. Now, we use `stgToCmmUseStdApThunk` to indicate
whether precomputed AP thunks in the RTS should be used, which
defaults to `True`, unless `-ticky-ap-thunk` is passed.
`-finfo-table-map` now also implies `-ticky-ap-thunk`, since when
doing IPE profiling we want the generated AP thunks to be unique.
Fixes #27502.
-------------------------
Metric Decrease:
T3064
-------------------------
Co-authored-by: Codex <codex@openai.com>
(cherry picked from commit 5aa7000ae246ae6a706437799338295b5801a629)