[Git][ghc/ghc][ghc-9.4] 18 commits: ApplicativeDo: Set pattern location before running exhaustiveness checker

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Dec 14 16:27:46 UTC 2022



Matthew Pickering pushed to branch ghc-9.4 at Glasgow Haskell Compiler / GHC


Commits:
51c6051b by Matthew Pickering at 2022-12-13T09:30:47+00:00
ApplicativeDo: Set pattern location before running exhaustiveness checker

This improves the error messages of the exhaustiveness checker when
checking statements which have been moved around with ApplicativeDo.

Before:

Test.hs:2:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘Maybe ()’ not matched: Nothing
  |
2 |   let x = ()
  |   ^^^^^^^^^^

After:

Test.hs:4:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘Maybe ()’ not matched: Nothing
  |
4 |   ~(Just res1) <- seq x (pure $ Nothing @())
  |

Fixes #22483

(cherry picked from commit 74c767df770766d8d52e87b9ff7da10f94620a91)

- - - - -
13040bf0 by Matthew Pickering at 2022-12-13T09:30:47+00:00
Typeable: Fix module locations of some definitions in GHC.Types

There was some confusion in Data.Typeable about which module certain
wired-in things were defined in. Just because something is wired-in
doesn't mean it comes from GHC.Prim, in particular things like LiftedRep
and RuntimeRep are defined in GHC.Types and that's the end of the story.

Things like Int#, Float# etc are defined in GHC.Prim as they have no
Haskell definition site at all so we need to generate type
representations for them (which live in GHC.Types).

Fixes #22510

(cherry picked from commit 1d3a8b8ec98e6eedf8943e19780ec374c2491e7f)

- - - - -
127dcc49 by Ian-Woo Kim at 2022-12-13T09:30:47+00:00
Truncate eventlog event for large payload (#20221)

RTS eventlog events for postCapsetVecEvent are truncated if payload
is larger than EVENT_PAYLOAD_SIZE_MAX
Previously, postCapsetVecEvent records eventlog event with payload
of variable size larger than EVENT_PAYLOAD_SIZE_MAX (2^16) without
any validation, resulting in corrupted data.
For example, this happens when a Haskell binary is invoked with very
long command line arguments exceeding 2^16 bytes (see #20221).
Now we check the size of accumulated payload messages incrementally,
and truncate the message just before the payload size exceeds
EVENT_PAYLOAD_SIZE_MAX. RTS will warn the user with a message showing
how many arguments are truncated.

(cherry picked from commit 2057c77d08cb8422857d182a3691f98dccd0c7d6)

- - - - -
f84d7562 by Simon Peyton Jones at 2022-12-13T09:30:47+00:00
Add a missing varToCoreExpr in etaBodyForJoinPoint

This subtle bug showed up when compiling a library with 9.4.
See #22491.  The bug is present in master, but it is hard to
trigger; the new regression test T22491 fails in 9.4.

The fix was easy: just add a missing varToCoreExpr in
etaBodyForJoinPoint.

The fix is definitely right though!

(cherry picked from commit afc2540daf6ca6baa09ab147b792da08d66d878c)

- - - - -
8c85afe3 by sheaf at 2022-12-13T09:30:47+00:00
Fix @since annotations on WithDict and Coercible

Fixes #22453

(cherry picked from commit 68c966cd3c9d581bac4573807e433fe8d063445f)

- - - - -
7fbcb2c6 by Ben Gamari at 2022-12-13T09:30:47+00:00
eventlog: Ensure that IPE output contains actual info table pointers

The refactoring in 866c736e introduced a rather subtle change in the
semantics of the IPE eventlog output, changing the eventlog field from
encoding info table pointers to "TNTC pointers" (which point to entry
code when tables-next-to-code is enabled). Fix this.

Fixes #22452.

(cherry picked from commit 268a3ce952f6be00a1dd164dc4d7acb346045e90)

- - - - -
ea7fb64d by Matthew Pickering at 2022-12-13T09:30:47+00:00
driver: Fix -fdefer-diagnostics flag

The `withDeferredDiagnostics` wrapper wasn't doing anything because the
session it was modifying wasn't used in hsc_env. Therefore the fix is
simple, just push the `getSession` call into the scope of
`withDeferredDiagnostics`.

Fixes #22391

(cherry picked from commit 6dab0046b575e102bf3245fd63d5ac6bc6f4204d)

- - - - -
5912ca80 by Ben Gamari at 2022-12-13T09:30:47+00:00
Fix manifest filename when writing Windows .rc files

As noted in #12971, we previously used `show` which resulted in
inappropriate escaping of non-ASCII characters.

(cherry picked from commit a4dbd102af1989526ca87f4dd949f72231284e68)

- - - - -
f34261f3 by Ben Gamari at 2022-12-13T09:30:47+00:00
Write response files in UTF-8 on Windows

This reverts the workaround introduced in
f63c8ef33ec9666688163abe4ccf2d6c0428a7e7, which taught our response file
logic to write response files with the `latin1` encoding to workaround
`gcc`'s lacking Unicode support. This is now no longer necessary (and in
fact actively unhelpful) since we rather use Clang.

(cherry picked from commit 30f0d9a9ded55a822e094847d5ac8087262fb8da)

- - - - -
3e648642 by Andreas Klebinger at 2022-12-13T09:30:47+00:00
Properly cast values when writing/reading unboxed sums.

Unboxed sums might store a Int8# value as Int64#. This patch
makes sure we keep track of the actual value type.

See Note [Casting slot arguments] for the details.

(cherry picked from commit 31462d98c31e3ef48af2f6c6f2d379d74ccc63f5)

- - - - -
7a40261f by Dai at 2022-12-13T09:30:47+00:00
Add VecSlot for unboxed sums of SIMD vectors

This patch adds the missing `VecRep` case to `primRepSlot` function and
all the necessary machinery to carry this new `VecSlot` through code
generation. This allows programs involving unboxed sums of SIMD vectors
to be written and compiled.

Fixes #22187

(cherry picked from commit 5b3a992f5d166007c3c5a22f120ed08e0a27f01a)

- - - - -
19d7a5fc by sheaf at 2022-12-13T09:30:47+00:00
Remove SIMD conversions

This patch makes it so that packing/unpacking SIMD
vectors always uses the right sized types, e.g.
unpacking a Word16X4# will give a tuple of Word16#s.

As a result, we can get rid of the conversion instructions
that were previously required.

Fixes #22296

(cherry picked from commit 6d7d91817795d7ee7f45557411368a1738daa488)

- - - - -
2e778abc by sheaf at 2022-12-13T09:30:48+00:00
Cmm Lint: relax SIMD register assignment check

As noted in #22297, SIMD vector registers can be used
to store different kinds of values, e.g. xmm1 can be used
both to store integer and floating point values.
The Cmm type system doesn't properly account for this, so
we weaken the Cmm register assignment lint check to only
compare widths when comparing a vector type with its
allocated vector register.

(cherry picked from commit 3be48877e204fca8e5d5ab984186e0d20d81f262)

- - - - -
052dc022 by sheaf at 2022-12-13T09:30:48+00:00
Disable some SIMD tests on non-X86 architectures

(cherry picked from commit f7b7a3122185222d5059e37315991afcf319e43c)

- - - - -
3cc20a1a by Andreas Klebinger at 2022-12-13T09:30:48+00:00
Improve stg lint for unboxed sums.

It now properly lints cases where sums end up distributed
over multiple args after unarise.

Fixes #22026.

(cherry picked from commit 8d2dbe2db4cc7c8b6d39b1ea64b0508304a3273c)

- - - - -
fcce6b7e by Simon Peyton Jones at 2022-12-13T09:30:48+00:00
Fix a trivial typo in dataConNonlinearType

Fixes #22416

(cherry picked from commit 294f907370fadd3313f8c5e6aa87a93c8b86f139)

- - - - -
c43e5681 by Gabriella Gonzalez at 2022-12-13T09:30:48+00:00
Serialize builds of `rts` and `system-cxx-std-lib`

Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/22099

I cannot say for sure that this will fix the linked issue, but
I explained why I believe this fixes the root problem in:

https://gitlab.haskell.org/ghc/ghc/-/issues/22099#note_461386

… and when we applied this patch internally the problem appeared to
disappear for a few builds in a row with a large number of cores.

The short summary of the above comment is that the `Makefile`
serializes the package registrations using `ghc-pkgs`, with the
exception of two packages (`rts` and `system-cxx-std-lib`) and
we expect that this one instance of parallelism that was still
left in the `Makefile` was the root cause of the flaky build
failure.

This fix would be consistent with two known things about the
failure:

- The build failure only occurs for parallel `Make` builds

  … and these are the only two `ghc-pkg` calls that run concurrently

- The error first appeared in the GHC 9.4 branch and was absent in GHC 9.2

  … and GHC 9.4 was the first release that included `system-cxx-std-lib`
  (as far as I know), which would explain why this problem
  didn't happen before.

The change here forces the two packages to be registered in
sequence.

This problem will of course go away in GHC 9.6 by virtue of
dropping the `make`-based build, but since the GHC 9.4 branch is
supported and active we wanted to upstream this patch to the
9.4 development branch.

- - - - -
5e9ac694 by Matthew Pickering at 2022-12-14T16:19:58+00:00
Package Imports: Get candidate packages also from re-exported modules

Previously we were just looking at the direct imports to try and work
out what a package qualifier could apply to but #22333 pointed out we
also needed to look for reexported modules.

Fixes #22333

(cherry picked from commit 58a138d0f62c057333e4fd15fe20df64492b1dac)

- - - - -


30 changed files:

- + compiler/GHC/Builtin/PrimOps/Casts.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/Lint.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Utils.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/Linker/Windows.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/Stg/Syntax.hs
- compiler/GHC/Stg/Unarise.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/SysTools/Process.hs
- compiler/GHC/Tc/Instance/Typeable.hs
- compiler/GHC/Types/Literal.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/ghc.cabal.in
- docs/users_guide/debugging.rst
- ghc.mk
- libraries/base/Data/Coerce.hs
- libraries/base/GHC/Exts.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/81cae7b73588ad77ef2e8e0e1dbe4052ecd0155f...5e9ac6946d7082502fe05546d32429e2f3aca9b6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/81cae7b73588ad77ef2e8e0e1dbe4052ecd0155f...5e9ac6946d7082502fe05546d32429e2f3aca9b6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221214/db37d993/attachment-0001.html>


More information about the ghc-commits mailing list