[Git][ghc/ghc][ghc-9.10] 60 commits: Escape multiple arguments in the settings file

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Fri Dec 20 01:59:01 UTC 2024



Andreas Klebinger pushed to branch ghc-9.10 at Glasgow Haskell Compiler / GHC


Commits:
9cd1ae5b by Fendor at 2024-12-13T13:18:27+01:00
Escape multiple arguments in the settings file

Uses responseFile syntax.

The issue arises when GHC is installed on windows into a location that
has a space, for example the user name is 'Fake User'.
The $topdir will also contain a space, consequentially.
When we resolve the top dir in the string `-I$topdir/mingw/include`,
then `words` will turn this single argument into `-I/C/Users/Fake` and
`User/.../mingw/include` which trips up the flag argument parser of
various tools such as gcc or clang.
We avoid this by escaping the $topdir before replacing it in
`initSettngs`.
Additionally, we allow to escape spaces and quotation marks for
arguments in `settings` file.

Add regression test case to count the number of options after variable
expansion and argument escaping took place.
Additionally, we check that escaped spaces and double quotation marks are
correctly parsed.

(cherry picked from commit 31bf85ee49fe2ca0b17eaee0774e395f017a9373)

- - - - -
8d3b0c32 by Andreas Klebinger at 2024-12-13T13:29:03+01:00
Changelog for !11938 - Escape multiple arguments in the settings file.

- - - - -
156b8aa3 by Andreas Klebinger at 2024-12-13T19:46:22+01:00
RTS: Emit warning when -M < -H

Fixes #24487

(cherry picked from commit 9e91744a19dcd699896341baadf98f99b1250839)

- - - - -
4d5d4404 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: fix typos and namings (fixes #24602)

You may noted that I've also changed term of

```
, global "h$vt_double" ||= toJExpr IntV
```

See "IntV"

and

```
  WaitReadOp  -> \[] [fd] -> pure $ PRPrimCall $ returnS (app
"h$waidRead" [fd])
```

See "h$waidRead"

(cherry picked from commit c70b9ddb6dc232e22a49ddc757865bd3bc9c46a7)

- - - - -
fc56b471 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: trivial checks for variable presence (fixes #24602)

(cherry picked from commit 3db54f9bcdcd20a2497447bf76176470db900143)

- - - - -
1ed663cc by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: fs module imported twice (by emscripten and by ghc-internal). ghc-internal import wrapped
in a closure to prevent conflict with emscripten (fixes #24602)

Better solution is to use some JavaScript module system like AMD, CommonJS or even UMD. It will be investigated at other issues.
At first glance we should try UMD (See https://github.com/umdjs/umd)

(cherry picked from commit 777f108f74f0a81274775d504dffe46c5fdfc33f)

- - - - -
d3477264 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: thread.js requires h$fds and h$fdReady to be declared for static code analysis, minimal
code copied from GHCJS (fixes #24602)

I've just copied some old pieces of GHCJS from publicly available sources (See https://github.com/Taneb/shims/blob/a6dd0202dcdb86ad63201495b8b5d9763483eb35/src/io.js#L607).
Also I didn't put details to h$fds. I took minimal and left only its object initialization: `var h$fds = {};`

(cherry picked from commit a45a57127bb7eaceae92e0edf057c053eb4d5367)

- - - - -
549ce324 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: heap and stack overflows reporting defined as js hard failure (fixes #24602)

These errors were treated as a hard failure for browser application. The fix is trivial: just throw error.

(cherry picked from commit ad90bf1237e0c9d2013399bd8cd1315f2845d9e7)

- - - - -
8335f195 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Stubs for code without actual implementation detected by Google Closure Compiler (fixes #24602)

These errors were fixed just by introducing stubbed functions with throw for further implementation.

(cherry picked from commit 5962fa526e071d77fd4970b57d957a622e13207c)

- - - - -
db00df21 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Add externs to linker (fixes #24602)

After enabling jsdoc and built-in google closure compiler types I was needed to deal with the following:

1. Define NodeJS-environment types. I've just copied minimal set of externs from semi-official repo (see https://github.com/externs/nodejs/blob/6c6882c73efcdceecf42e7ba11f1e3e5c9c041f0/v8/nodejs.js#L8).
2. Define Emscripten-environment types: `HEAP8`. Emscripten already provides some externs in our code but it supposed to be run in some module system. And its definitions do not work well in plain bundle.
3. We have some functions which purpose is to add to functions some contextual information via function properties. These functions should be marked as `modifies` to let google closure compiler remove calls if these functions are not used actually by call graph. Such functions are: `h$o`, `h$sti`, `h$init_closure`, `h$setObjInfo`.
4. STG primitives such as registries and stuff from `GHC.StgToJS`. `dXX` properties were already present at externs generator function but they are started from `7`, not from `1`. This message is related: `// fixme does closure compiler bite us here?`

(cherry picked from commit a0694298aad5f2f428311d6e787484a250c9de43)

- - - - -
3a270b4d by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: added both tests: for size and for correctness (fixes #24602)

By some reason MacOS builds add to stderr messages like:

    Ignoring unexpected archive entry:
    __.SYMDEF
    ...

However I left stderr to `/dev/null` for compatibility with linux CI builds.

(cherry picked from commit e58bb29f8a4808fd4b74b653b1893f78121c7df4)

- - - - -
5348bbe9 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Disable js linker warning for empty symbol table to make js tests running consistent across environments

(cherry picked from commit 909f3a9c8dac5d15c2492c008e370be60f50b50c)

- - - - -
68da8237 by Serge S. Gulin at 2024-12-18T16:28:16+01:00
JS: Add special preprocessor for js files due of needing to keep jsdoc comments (fixes #24602)

Our js files have defined google closure compiler types at jsdoc entries but these jsdoc entries are removed by cpp preprocessor. I considered that reusing them in javascript-backend would be a nice thing. Right now haskell processor uses `-traditional` option to deal with comments and `//` operators.
But now there are following compiler options: `-C` and `-CC`.
You can read about them at GCC (see https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-CC) and CLang (see https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-CC).
It seems that `-CC` works better for javascript jsdoc than `-traditional`.
At least it leaves `/* ... */` comments w/o changes.

(cherry picked from commit 83eb10da239e6bef0d06dbba174809f99c463d8d)

- - - - -
e234268d by Cheng Shao at 2024-12-18T16:28:16+01:00
Update autoconf scripts

Scripts taken from autoconf 948ae97ca5703224bd3eada06b7a69f40dd15a02

(cherry picked from commit 36f2c3422d7f3620078dba701f57275a3708aff5)

- - - - -
f1de8643 by Sylvain Henry at 2024-12-18T16:28:16+01:00
GHCi: support inlining breakpoints (#24712)

When a breakpoint is inlined, its context may change (e.g. tyvars in
scope). We must take this into account and not used the breakpoint tick
index as its sole identifier. Each instance of a breakpoint (even with
the same tick index) now gets a different "info" index.

We also need to distinguish modules:
- tick module: module with the break array (tick counters, status, etc.)
- info module: module having the CgBreakInfo (info at occurrence site)

(cherry picked from commit b85b11994e0130ff2401dd4bbdf52330e0bcf776)

- - - - -
cd9f53ba by Cheng Shao at 2024-12-18T16:28:16+01:00
wasm: use scheduler.postTask() for context switch when available

This patch makes use of scheduler.postTask() for JSFFI context switch
when it's available. It's a more principled approach than our
MessageChannel based setImmediate() implementation, and it's available
in latest version of Chromium based browsers.

(cherry picked from commit 43d48b449a46e805e3baeafbafa62b6cd6f761c9)

- - - - -
c01dc7f1 by Matthew Craven at 2024-12-18T16:28:16+01:00
Add test cases for #24664

...since none are present in the original MR !12463 fixing this issue.

(cherry picked from commit a19201d42cfd3aa54faeb1b5a95b715b9a67a01a)

- - - - -
5a8790db by Arsen Arsenović at 2024-12-18T16:28:16+01:00
Split out the C-- preprocessor, and make it pass -g0

Previously, C-- was processed with the C preprocessor program.  This
means that it inherited flags passed via -optc.  A flag that is somewhat
often passed through -optc is -g.  At certain -g levels (>=2), GCC
starts emitting defines *after* preprocessing, for the purposes of
debug info generation.  This is not useful for the C-- compiler, and, in
fact, causes lexer errors.  We can suppress this effect (safely, if
supported) via -g0.

As a workaround, in older versions of GCC (<=10), GCC only emitted
defines if a certain set of -g*3 flags was passed.  Newer versions check
the debug level.  For the former, we filter out those -g*3 flags and,
for the latter, we specify -g0 on top of that.

As a compatible and effective solution, this change adds a C--
preprocessor distinct from the C compiler and preprocessor, but that
keeps its flags.  The command line produced for C-- preprocessing now
looks like:

  $pgmCmmP $optCs_without_g3 $g0_if_supported $optCmmP

Closes: https://gitlab.haskell.org/ghc/ghc/-/issues/24474
(cherry picked from commit 25b0b40467d0a12601497117c0ad14e1fcab0b74)

- - - - -
f2cc943d by Andreas Klebinger at 2024-12-18T16:28:16+01:00
Add release notes for some backported 9.10.2 patches.

Contains notes for:

!11938: Escape multiple arguments in the settings file
!12201: RTS: Emit warning when -M < -H
!12495: Update autoconf scripts
!12500: GHCi: support cross-module inlining of breakpoints
!12550: wasm: use scheduler.postTask() for context switch when available
!12569: Split out the C-- preprocessor, and make it pass -g0

- - - - -
1016a4b1 by Andreas Klebinger at 2024-12-18T16:28:17+01:00
-fprof-late: Only insert cost centres on functions/non-workfree cafs.

They are usually useless and doing so for data values comes with
a large compile time/code size overhead.

Fixes #24103

(cherry picked from commit 9b4129a580e6c1d18197ef2ed3a8b89d52a2b133)

- - - - -
0c850206 by Ben Gamari at 2024-12-18T16:28:17+01:00
IPE: Eliminate dependency on Read

Instead of encoding the closure type as decimal string we now simply
represent it as an integer, eliminating the need for `Read` in
`GHC.Internal.InfoProv.Types.peekInfoProv`.

Closes #24504.

-------------------------
Metric Decrease:
    T24602_perf_size
    size_hello_artifact
-------------------------

(cherry picked from commit ab840ce6f83a74f36dac939d087b69f97404399a)

- - - - -
c15c6a8d by Cheng Shao at 2024-12-18T16:28:17+01:00
testsuite: fix testwsdeque with recent clang

This patch fixes compilation of testwsdeque.c with recent versions of
clang, which will fail with the error below:

```
testwsdeque.c:95:33: error:
     warning: format specifies type 'long' but the argument has type 'void *' [-Wformat]
       95 |         barf("FAIL: %ld %d %d", p, n, val);
          |                     ~~~         ^

testwsdeque.c:95:39: error:
     warning: format specifies type 'int' but the argument has type 'StgWord' (aka 'unsigned long') [-Wformat]
       95 |         barf("FAIL: %ld %d %d", p, n, val);
          |                            ~~         ^~~
          |                            %lu

testwsdeque.c:133:42: error:
     error: incompatible function pointer types passing 'void (void *)' to parameter of type 'OSThreadProc *' (aka 'void *(*)(void *)') [-Wincompatible-function-pointer-types]
      133 |         createOSThread(&ids[n], "thief", thief, (void*)(StgWord)n);
          |                                          ^~~~~

/workspace/ghc/_build/stage1/lib/../lib/x86_64-linux-ghc-9.11.20240502/rts-1.0.2/include/rts/OSThreads.h:193:51: error:
     note: passing argument to parameter 'startProc' here
      193 |                                     OSThreadProc *startProc, void *param);
          |                                                   ^

2 warnings and 1 error generated.
```

(cherry picked from commit a9979f55d0f688fabd25ee318e44b9addd904988)

- - - - -
3329ca03 by Cheng Shao at 2024-12-18T16:28:17+01:00
ghc-heap: fix typo in ghc-heap cbits

(cherry picked from commit 2b1af08b94024c104b54eadd710855e9f8a90fb6)

- - - - -
a15b3383 by doyougnu at 2024-12-18T16:28:17+01:00
testsuite: expand size testing infrastructure

- closes #24191
- adds windows_skip, wasm_skip, wasm_arch, find_so, _find_so
- path_from_ghcPkg, collect_size_ghc_pkg, collect_object_size, find_non_inplace functions to testsuite
- adds on_windows and req_dynamic_ghc predicate to testsuite

The design is to not make the testsuite too smart and simply offload to
ghc-pkg for locations of object files and directories.

(cherry picked from commit 9bae34d87f6c978e03031c549920071857c9080c)

- - - - -
4b5b67a4 by Matthew Pickering at 2024-12-18T16:28:17+01:00
tests: Widen acceptance window for dir and so size tests

These are testing things which are sometimes out the control of a GHC
developer. Therefore we shouldn't fail CI if something about these
dependencies change because we can't do anything about it.

It is still useful to have these statistics for visualisation in grafana
though.

Ticket #24759

(cherry picked from commit c49493f242fc78fbf23ef3642df531a19c3b4b24)

- - - - -
216ad9f9 by Matthew Pickering at 2024-12-18T16:28:17+01:00
Disable rts_so test

It has already manifested large fluctuations and destabilising CI

Fixes #24762

(cherry picked from commit 9562808d02db67838844d874c632f18af904949c)

- - - - -
20552645 by Torsten Schmits at 2024-12-18T16:28:17+01:00
refactor quadratic search in warnMissingHomeModules

(cherry picked from commit bc672166acd8f2815d58b6d214e69373abec4486)

- - - - -
158c9dbf by Torsten Schmits at 2024-12-18T16:28:17+01:00
add test that runs MakeDepend on thousands of modules

(cherry picked from commit 7875e8cbe5d9b69a1a77354317b2bf9478172686)

- - - - -
ee3e6c79 by Matthew Pickering at 2024-12-18T16:28:17+01:00
driver: Fix -Wmissing-home-modules when multiple units have the same module name

It was assumed that module names were unique but that isn't true with
multiple units.

The fix is quite simple, maintain a set of `(ModuleName, UnitId)` and
query that to see whether the module has been specified.

Fixes #25122

(cherry picked from commit 951ce3d5904a1d34d49787d444f99e251e24d4e7)

- - - - -
1faf2c60 by Sylvain Henry at 2024-12-18T16:28:17+01:00
Reverse arguments to stgCallocBytes (fix #24828)

(cherry picked from commit 6838a7c32ca29b5d44adc9d6280d3a960f31be7c)

- - - - -
6d00956c by Ben Gamari at 2024-12-18T16:28:17+01:00
rts: Fix size of StgOrigThunkInfo frames

Previously the entry code of the `stg_orig_thunk` frame failed to
account for the size of the profiling header as it hard-coded the frame
size. Fix this.

Fixes #24809.

(cherry picked from commit 6d7e6ad803be11cb7a79dca727c37e4ef21cda4b)

- - - - -
0be2daaf by Fendor at 2024-12-18T16:28:17+01:00
Add regression test T24809 for stg_orig_thunk_info_frame size

(cherry picked from commit c645fe406cd4a3f4c152e51dfbcdeeb5e2930fb1)

- - - - -
80afd1a9 by Andreas Klebinger at 2024-12-18T16:28:17+01:00
bindists: Check for existence of share folder before trying to copy it.

This folder isn't distributed in windows bindists

A lack of doing so resulted us copying loads of files twice.

(cherry picked from commit 4181aa40fff5653a121cd2ece33ab0f7454d421d)

- - - - -
af123155 by Matthew Pickering at 2024-12-18T16:28:17+01:00
Remove ad-hoc installation of mingw toolchain in relocatable bindists

This reverts 616ac30026e8dd7d2ebb98d92dde071eedf5d951

The choice about whether to install mingw is taken in the installation
makefile.

This is also broken on non-windows systems.

The actual issue was the EnableDistroToolchain variable wasn't declared
in mk/config.mk and therefore the check to install mingw was failing.

(cherry picked from commit d216510e43deca5a9a221d2b799face293e38299)

- - - - -
50974a94 by Cheng Shao at 2024-12-18T16:28:17+01:00
testsuite: fix T17920 for wasm backend

T17920 was marked as fragile on wasm before; it can be trivially fixed
by avoiding calling variadic printf() in cmm.

(cherry picked from commit 7b4c19983bf6bc11b519b437a6204c38672721ea)

- - - - -
c8f98d01 by Simon Peyton Jones at 2024-12-18T16:28:17+01:00
Better skolemisation

As #24810 showed, it is (a little) better to skolemise en-bloc,
so that Note [Let-bound skolems] fires more often.

See Note [Skolemisation en bloc] in GHC.Tc.Utils.Instantiate.

(cherry picked from commit 3d9e4ce68a55f6bc5246d2d77729676010e85bbd)

- - - - -
e57d1433 by Ryan Scott at 2024-12-18T16:28:17+01:00
Add missing parenthesizePat in cvtp

We need to ensure that the output of `cvtp` is parenthesized (at precedence
`sigPrec`) so that any pattern signatures with a surrounding pattern signature
can parse correctly.

Fixes #24837.

(cherry picked from commit a3cd3a1d0d186f2aa4d0273c6b3e74a442de2ef0)

- - - - -
05338430 by crumbtoo at 2024-12-18T16:28:17+01:00
user_guide: Fix typo in MultiWayIf chapter

Close #24829

(cherry picked from commit c5e00c35927d574f71bf77449817b131d1749750)

- - - - -
53eeffd6 by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: fix missing function prototypes in ClosureMacros.h

(cherry picked from commit 3ca72ad974169aa39f391774875a9cc2a77ee967)

- - - - -
bbe4accd by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: use __builtin_offsetof to implement STG_FIELD_OFFSET

This patch fixes the STG_FIELD_OFFSET macro definition by using
__builtin_offsetof, which is what gcc/clang uses to implement offsetof
in standard C. The previous definition that uses NULL pointer involves
subtle undefined behavior in C and thus reported by
UndefinedBehaviorSanitizer as well:

```
rts/Capability.h:243:58: runtime error: member access within null pointer of type 'Capability' (aka 'struct Capability_')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/Capability.h:243:58
```

(cherry picked from commit 05c4fafbc1693164d5f06ed062fc73bbf3f78deb)

- - - - -
4879286a by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: fix an unaligned load in nonmoving gc

This patch fixes an unaligned load in nonmoving gc by ensuring the
closure address is properly untagged first before attempting to
prefetch its header. The unaligned load is reported by
UndefinedBehaviorSanitizer:

```
rts/sm/NonMovingMark.c:921:9: runtime error: member access within misaligned address 0x0042005f3a71 for type 'StgClosure' (aka 'struct StgClosure_'), which requires 8 byte alignment
0x0042005f3a71: note: pointer points here
 00 00 00  98 43 13 8e 12 7f 00 00  50 3c 5f 00 42 00 00 00  58 17 b7 92 12 7f 00 00  89 cb 5e 00 42
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/NonMovingMark.c:921:9
```

This issue had previously gone unnoticed since it didn't really harm
runtime correctness, the invalid header address directly loaded from a
tagged pointer is only used as prefetch address and will not cause
segfaults. However, it still should be corrected because the prefetch
would be rendered useless by this issue, and untagging only involves a
single bitwise operation without memory access so it's cheap enough to
add.

(cherry picked from commit c77a48af6e1f38337b305fec794e8c999f1c7f3a)

- - - - -
59b84e0f by Cheng Shao at 2024-12-18T16:28:17+01:00
rts: ensure gc_thread/gen_workspace is allocated with proper alignment

gc_thread/gen_workspace are required to be aligned by 64 bytes.
However, this property has not been properly enforced before, and
numerous alignment violations at runtime has been caught by
UndefinedBehaviorSanitizer that look like:

```
rts/sm/GC.c:1167:8: runtime error: member access within misaligned address 0x0000027a3390 for type 'gc_thread' (aka 'struct gc_thread_'), which requires 64 byte alignment
0x0000027a3390: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1167:8

rts/sm/GC.c:1184:13: runtime error: member access within misaligned address 0x0000027a3450 for type 'gen_workspace' (aka 'struct gen_workspace_'), which requires 64 byte alignment
0x0000027a3450: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior rts/sm/GC.c:1184:13
```

This patch fixes the gc_thread/gen_workspace misalignment issue by
explicitly allocating them with alignment constraint.

(cherry picked from commit 7a660042395614e4b19534baf5b779f65059861e)

- - - - -
c4507307 by Cheng Shao at 2024-12-18T16:28:17+01:00
hadrian: disable PIC for in-tree GMP on wasm32

This patch disables PIC for in-tree GMP on wasm32 target. Enabling PIC
unconditionally adds undesired code size and runtime overhead for
wasm32.

(cherry picked from commit f9c1ae122ec642c0d9236dffc971bc2d1ca38fba)

- - - - -
794e71e1 by Cheng Shao at 2024-12-18T16:28:17+01:00
hadrian: disable in-tree gmp fft code path for wasm32

This patch disables in-tree GMP FFT code paths for wasm32 target in
order to give up some performance of multiplying very large operands
in exchange for reduced code size.

(cherry picked from commit 1a32f82807ae01813f14bdf12fed75eb32799e18)

- - - - -
d08b9b83 by Cheng Shao at 2024-12-18T16:28:18+01:00
hadrian: build in-tree GMP with malloc-notreentrant on wasm32

This patch makes hadrian build in-tree GMP with the
--enable-alloca=malloc-notreentrant configure option. We will only
need malloc-reentrant when we have threaded RTS and SMP support on
wasm32, which will take some time to happen, before which we should
use malloc-notreentrant to avoid undesired runtime overhead.

(cherry picked from commit 06277d56de91c8d21cbf71e8bc4096925b863acc)

- - - - -
ece0a0db by Andreas Klebinger at 2024-12-18T16:28:18+01:00
Add release notes for some backported patches.

Add entries for the following backported MRs:

!12498: -fprof-late: Don't add cost centres to static data.
!12565: IPE: Eliminate dependency on Read
!12591: ghc-heap: fix typo in ghc-heap cbits
!12607: refactor quadratic search in warnMissingHomeModules
!12621: rts: Fix size of StgOrigThunkInfo frames
!12649 # bindists: Check for existence of shared folder before trying to copy it.
!12653: Better skolemisation
!12734: Various rts fixes for issues spotted by UndefinedBehaviorSanitizer
!12592: hadrian: adjust in-tree GMP configure options for wasm32

- - - - -
1b847dec by Cheng Shao at 2024-12-18T16:28:18+01:00
hadrian: fix hadrian building with ghc-9.10.1

(cherry picked from commit be514bb48629747258416e602c8b00810b3863b0)

- - - - -
7dd1423d by Cheng Shao at 2024-12-18T16:28:18+01:00
linters: fix lint-whitespace compilation with ghc-9.10.1

(cherry picked from commit ad38e954bf088b43fa1cecfeaf474b6b9c11e2ed)

- - - - -
86723eed by Zubin Duggal at 2024-12-18T16:28:18+01:00
testsuite: Handle exceptions in framework_fail when testdir is not initialised

When `framework_fail` is called before initialising testdir, it would fail with
an exception reporting the testdir not being initialised instead of the actual failure.

Ensure we report the actual reason for the failure instead of failing in this way.

One way this can manifest is when trying to run a test that doesn't exist using `--only`

(cherry picked from commit c56d728e1f8702db02cf7e7e3cdc567b3df47ac3)

- - - - -
1d787538 by Arsen Arsenović at 2024-12-18T16:28:18+01:00
Add the cmm_cpp_is_gcc predicate to the testsuite

A future C-- test called T24474-cmm-override-g0 relies on the
GCC-specific behaviour of -g3 implying -dD, which, in turn, leads to it
emitting #defines past the preprocessing stage.  Clang, at least, does
not do this, so the test would fail if ran on Clang.

As the behaviour here being tested is ``-optCmmP-g3'' undoing effects of
the workaround we apply as a fix for bug #24474, and the workaround was
for GCC-specific behaviour, the test needs to be marked as fragile on
other compilers.

(cherry picked from commit 4d59abf295cd371448f22c1724b955dce4974302)

- - - - -
a73ffe72 by Ben Gamari at 2024-12-18T16:35:45+01:00
rts: Fix TSAN_ENABLED CPP guard

This should be `#if defined(TSAN_ENABLED)`, not `#if TSAN_ENABLED`,
lest we suffer warnings.

(cherry picked from commit c8a4c050626f451461a3667589d40004b2547a1c)

- - - - -
a235a078 by Cheng Shao at 2024-12-18T16:35:56+01:00
rts: fix errors when compiling with TSAN

This commit fixes rts compilation errors when compiling with TSAN:

- xxx_FENCE macros are redefined and trigger CPP warnings.
- Use SIZEOF_W. WORD_SIZE_IN_BITS is provided by MachDeps.h which
  Cmm.h doesn't include by default.

(cherry picked from commit e91dad93ff50b429d5717c81fbd5fe20ff2defd9)

- - - - -
6c30c754 by Cheng Shao at 2024-12-18T16:36:11+01:00
rts: fix clang-specific errors when compiling with TSAN

This commit fixes clang-specific rts compilation errors when compiling
with TSAN:

- clang doesn't have -Wtsan flag
- Fix prototype of ghc_tsan_* helper functions
- __tsan_atomic_* functions aren't clang built-ins and
  sanitizer/tsan_interface_atomic.h needs to be included
- On macOS, TSAN runtime library is
  libclang_rt.tsan_osx_dynamic.dylib, not libtsan. -fsanitize-thread
  as a link-time flag will take care of linking the TSAN runtime
  library anyway so remove tsan as an rts extra library

(cherry picked from commit a9ab9455b0159c955ea8c38ac113e4cbe47d410f)

- - - - -
c05d1181 by Cheng Shao at 2024-12-18T16:36:58+01:00
compiler: fix github link to __tsan_memory_order in a comment

(cherry picked from commit 865bd717cc4c63d6926138c5b8c71addcf70a1e7)

- - - - -
f39baa8c by Cheng Shao at 2024-12-18T16:38:32+01:00
ci: improve TSAN CI jobs

- Run TSAN jobs with +thread_sanitizer_cmm which enables Cmm
  instrumentation as well.
- Run TSAN jobs in deb12 which ships gcc-12, a reasonably recent gcc
  that @bgamari confirms he's using in #GHC:matrix.org. Ideally we
  should be using latest clang release for latest improvements in
  sanitizers, though that's left as future work.
- Mark TSAN jobs as manual+allow_failure in validate pipelines. The
  purpose is to demonstrate that we have indeed at least fixed
  building of TSAN mode in CI without blocking the patch to land, and
  once merged other people can begin playing with TSAN using their own
  dev setups and feature branches.

(cherry picked from commit 07cb627c8232f573bd6a8ea1b7c110ff3c1b5d22)

- - - - -
51d3b2d0 by Andrei Borzenkov at 2024-12-19T15:44:28+01:00
Improve pattern to type pattern transformation (23739)

`pat_to_type_pat` function now can handle more patterns:
  - TuplePat
  - ListPat
  - LitPat
  - NPat
  - ConPat

Allowing these new constructors in type patterns significantly
increases possible shapes of type patterns without `type` keyword.

This patch also changes how lookups in `lookupOccRnConstr` are
performed, because we need to fall back into
types when we didn't find a constructor on data level to perform
`ConPat` to type transformation properly.

(cherry picked from commit 2c0f8ddbdf351ed84395afa04a2654a7cbe2ad35)

- - - - -
164133ec by Andreas Klebinger at 2024-12-19T15:50:05+01:00
Removed a test whose change was not backported (T23764).

- - - - -
4e89c144 by Sylvain Henry at 2024-12-19T15:51:07+01:00
Type-check default declarations before deriving clauses (#24566)

See added Note and #24566. Default declarations must be type-checked
before deriving clauses.

(cherry picked from commit 52072f8e2121fe49a8367027efa3d8db32325f84)

- - - - -
6601403b by Simon Peyton Jones at 2024-12-19T18:36:54+01:00
Print more info about kinds in error messages

This fixes #24553, where GHC unhelpfully said

  error: [GHC-83865]
    • Expected kind ‘* -> * -> *’, but ‘Foo’ has kind ‘* -> * -> *’

See Note [Showing invisible bits of types in error messages]

(cherry picked from commit b72705e9b2ae5575aef92ede6ff975bbbe43004d)

- - - - -
1a7a0500 by Matthew Pickering at 2024-12-19T20:05:43+01:00
testsuite: workaround bug in python-3.12

There is some unexplained change to binding behaviour in python-3.12
which requires moving this import from the top-level into the scope of
the function.

I didn't feel any particular desire to do a deep investigation as to why
this changed as the code works when modified like this. No one in the
python IRC channel seemed to know what the problem was.

(cherry picked from commit 43aa99b8169fc6d8552844cd6fa0ce3cd4308185)

- - - - -


30 changed files:

- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC.hs
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/Cmm/ThreadSanitizer.hs
- compiler/GHC/Core/LateCC.hs
- compiler/GHC/Core/LateCC/TopLevelBinds.hs
- compiler/GHC/Core/LateCC/Types.hs
- compiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Core/TyCo/Ppr.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Iface/Recomp/Flags.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Runtime/Eval/Types.hs
- compiler/GHC/Runtime/Interpreter.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/220f15b278acb09433b529cf91c10fc756f6e67e...1a7a0500b165a5f746691a37df1329c421b08b19

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/220f15b278acb09433b529cf91c10fc756f6e67e...1a7a0500b165a5f746691a37df1329c421b08b19
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/20241219/3ffe445f/attachment-0001.html>


More information about the ghc-commits mailing list