[Git][ghc/ghc][wip/backports-9.8] 3 commits: configure: Fix #21712 again

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Oct 5 20:08:10 UTC 2023



Ben Gamari pushed to branch wip/backports-9.8 at Glasgow Haskell Compiler / GHC


Commits:
0a375448 by Ben Gamari at 2023-10-05T16:06:33-04:00
configure: Fix #21712 again

This is a bit of a shot in the dark to fix #24033, which appears to be
another instance of #21712. For some reason the ld-override logic
*still* appears to be active on Darwin targets (or at least one).
Consequently, on misconfigured systems we may choose a non-`ld64`
linker.

It's a bit unclear exactly what happened in #24033 but ultimately the
check added for #21712 was not quite right, checking for the
`ghc_host_os` (the value of which depends upon the bootstrap compiler)
instead of the target platform. Fix this.

Fixes #24033.

(cherry picked from commit f6b2751f58df5f4f83caa7a7ca56e66659d02b09)

- - - - -
b2791dba by Ben Gamari at 2023-10-05T16:07:05-04:00
rts/nonmoving: Fix on LLP64 platforms

Previously `NONMOVING_SEGMENT_MASK` and friends were defined with the `UL`
size suffix. However, this is wrong on LLP64 platforms like Windows,
where `long` is 32-bits.

Fixes #23003.
Fixes #24042.

(cherry picked from commit 8f6010b98f560200997a9d84a4e07bfd0ad6e496)

- - - - -
de4432cf by sheaf at 2023-10-05T16:07:22-04:00
Fix non-symbolic children lookup of fixity decl

The fix for #23664 did not correctly account for non-symbolic names
when looking up children of a given parent. This one-line fix changes
that.

Fixes #24037

(cherry picked from commit 8cee3fd7febdd97a9b4bcae7dddafe69b166149c)

- - - - -


5 changed files:

- compiler/GHC/Types/Name/Reader.hs
- m4/find_ld.m4
- rts/sm/NonMoving.h
- + testsuite/tests/rename/should_compile/T24037.hs
- testsuite/tests/rename/should_compile/all.T


Changes:

=====================================
compiler/GHC/Types/Name/Reader.hs
=====================================
@@ -1308,12 +1308,16 @@ childGREPriority (LookupChild { wantedParent = wanted_parent
         | isTermVarOrFieldNameSpace ns
         , isTermVarOrFieldNameSpace other_ns
         = Just 0
-        | ns == varName
+        | isValNameSpace varName
         , other_ns == tcName
-        -- When looking up children, we sometimes want to a symbolic variable
-        -- name to resolve to a type constructor, e.g. for an infix declaration
-        -- "infix +!" we want to take into account both class methods and associated
-        -- types. See test T10816.
+        -- When looking up children, we sometimes want a value name
+        -- to resolve to a type constructor.
+        -- For example, for an infix declaration "infixr 3 +!" or "infix 2 `Fun`"
+        -- inside a class declaration, we want to account for the possibility
+        -- that the identifier refers to an associated type (type constructor
+        -- NameSpace), when otherwise "+!" would be in the term-level variable
+        -- NameSpace, and "Fun" would be in the term-level data constructor
+        -- NameSpace.  See tests T10816, T23664, T24037.
         = Just 1
         | ns == tcName
         , other_ns == dataName


=====================================
m4/find_ld.m4
=====================================
@@ -61,19 +61,23 @@ AC_DEFUN([FIND_LD],[
         AC_CHECK_TARGET_TOOL([LD], [ld])
     }
 
-    if test "$ghc_host_os" = "darwin" ; then
+    case "$target" in
+    *-darwin)
         dnl N.B. Don't even try to find a more efficient linker on Darwin where
         dnl broken setups (e.g. unholy mixtures of Homebrew and the native
         dnl toolchain) are far too easy to come across.
         dnl
         dnl See #21712.
         AC_CHECK_TARGET_TOOL([LD], [ld])
-    elif test "x$enable_ld_override" = "xyes"; then
-        find_ld
-    else
-        AC_CHECK_TARGET_TOOL([LD], [ld])
-    fi
-
+        ;;
+    *)
+        if test "x$enable_ld_override" = "xyes"; then
+            find_ld
+        else
+            AC_CHECK_TARGET_TOOL([LD], [ld])
+        fi
+        ;;
+    esac
     CHECK_LD_COPY_BUG([$1])
 ])
 


=====================================
rts/sm/NonMoving.h
=====================================
@@ -17,13 +17,13 @@
 #include "BeginPrivate.h"
 
 // Segments
-#define NONMOVING_SEGMENT_BITS 15UL   // 2^15 = 32kByte
+#define NONMOVING_SEGMENT_BITS 15ULL   // 2^15 = 32kByte
 // Mask to find base of segment
-#define NONMOVING_SEGMENT_MASK ((1UL << NONMOVING_SEGMENT_BITS) - 1)
+#define NONMOVING_SEGMENT_MASK (((uintptr_t)1 << NONMOVING_SEGMENT_BITS) - 1)
 // In bytes
-#define NONMOVING_SEGMENT_SIZE (1UL << NONMOVING_SEGMENT_BITS)
+#define NONMOVING_SEGMENT_SIZE ((uintptr_t)1 << NONMOVING_SEGMENT_BITS)
 // In words
-#define NONMOVING_SEGMENT_SIZE_W ((1UL << NONMOVING_SEGMENT_BITS) / SIZEOF_VOID_P)
+#define NONMOVING_SEGMENT_SIZE_W (((uintptr_t)1 << NONMOVING_SEGMENT_BITS) / SIZEOF_VOID_P)
 // In blocks
 #define NONMOVING_SEGMENT_BLOCKS (NONMOVING_SEGMENT_SIZE / BLOCK_SIZE)
 


=====================================
testsuite/tests/rename/should_compile/T24037.hs
=====================================
@@ -0,0 +1,7 @@
+{-# LANGUAGE TypeFamilies, TypeOperators #-}
+
+module T24037 where
+
+class POrd a where
+  type Geq a b
+  infixr 6 `Geq`


=====================================
testsuite/tests/rename/should_compile/all.T
=====================================
@@ -215,6 +215,7 @@ test('T23434', normal, compile, [''])
 test('T23510b', normal, compile, [''])
 test('T23512b', normal, compile, [''])
 test('T23664', normal, compile, [''])
+test('T24037', normal, compile, [''])
 test('ExportWarnings1', extra_files(['ExportWarnings_base.hs', 'ExportWarnings_aux.hs']), multimod_compile, ['ExportWarnings1', '-v0 -Wno-duplicate-exports -Wx-custom'])
 test('ExportWarnings2', extra_files(['ExportWarnings_base.hs', 'ExportWarnings_aux.hs', 'ExportWarnings_aux2.hs']), multimod_compile, ['ExportWarnings2', '-v0 -Wno-duplicate-exports -Wx-custom'])
 test('ExportWarnings3', extra_files(['ExportWarnings_base.hs', 'ExportWarnings_aux.hs']), multimod_compile, ['ExportWarnings3', '-v0 -Wno-duplicate-exports -Wx-custom'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/86c1bdc48a6d4bc059c3fffb5c27d4fd69fc81bc...de4432cfef177c5669191f6a249f2d99ee00615d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/86c1bdc48a6d4bc059c3fffb5c27d4fd69fc81bc...de4432cfef177c5669191f6a249f2d99ee00615d
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/20231005/796cb787/attachment-0001.html>


More information about the ghc-commits mailing list