[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 12 commits: rts: Use C11-compliant static assertion syntax

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Jan 27 15:04:31 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
e480fbc2 by Ben Gamari at 2023-01-27T05:01:24-05:00
rts: Use C11-compliant static assertion syntax

Previously we used `static_assert` which is only available in C23. By
contrast, C11 only provides `_Static_assert`.

Fixes #22777

- - - - -
2648c09c by Andrei Borzenkov at 2023-01-27T05:02:07-05:00
Replace errors from badOrigBinding with new one (#22839)

Problem: in 02279a9c the type-level [] syntax was changed from a built-in name
to an alias for the GHC.Types.List constructor. badOrigBinding assumes that if
a name is not built-in then it must have come from TH quotation, but this is
not necessarily the case with [].

The outdated assumption in badOrigBinding leads to incorrect error messages.
This code:
  data []
Fails with "Cannot redefine a Name retrieved by a Template Haskell quote: []"

Unfortunately, there is not enough information in RdrName to directly determine
if the name was constructed via TH or by the parser, so this patch changes the
error message instead.

It unifies TcRnIllegalBindingOfBuiltIn and TcRnNameByTemplateHaskellQuote
into a new error TcRnBindingOfExistingName and changes its wording to avoid
guessing the origin of the name.

- - - - -
545bf8cf by Matthew Pickering at 2023-01-27T14:58:53+00:00
Revert "base: NoImplicitPrelude in Data.Void and Data.Kind"

Fixes CI errors of the form.

```
===> Command failed with error code: 1
ghc: panic! (the 'impossible' happened)
  GHC version 9.7.20230127:
	lookupGlobal
  Failed to load interface for ‘GHC.Num.BigNat’
  There are files missing in the ‘ghc-bignum’ package,
  try running 'ghc-pkg check'.
  Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Tc/Utils/Env.hs:154:32 in ghc:GHC.Tc.Utils.Env
  CallStack (from HasCallStack):
    panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error
Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
```

This reverts commit d0d7ba0fb053ebe7f919a5932066fbc776301ccd.

The module now lacks a dependency on GHC.Num.BigNat which it implicitly
depends on. It is causing all CI jobs to fail so we revert without haste
whilst the patch can be fixed.

Fixes #22848

- - - - -
e3423a11 by Zubin Duggal at 2023-01-27T10:04:19-05:00
bindist configure: Fail if find not found (#22691)

- - - - -
4fd8d6bd by Ben Gamari at 2023-01-27T10:04:19-05:00
testsuite: Introduce threaded2_sanity way

Incredibly, we previously did not have a single way which would test the
threaded RTS with multiple capabilities and the sanity-checker enabled.

- - - - -
906b0291 by Ben Gamari at 2023-01-27T10:04:19-05:00
rts: Relax Messages assertion

`doneWithMsgThrowTo` was previously too strict in asserting that the
`Message` is locked. Specifically, it failed to consider that the
`Message` may not be locked if we are deleting all threads during RTS
shutdown.

- - - - -
ea8b4455 by Ben Gamari at 2023-01-27T10:04:19-05:00
testsuite: Fix race in UnliftedTVar2

Previously UnliftedTVar2 would fail when run with multiple capabilities
(and possibly even with one capability) as it would assume that
`killThread#` would immediately kill the "increment" thread.

Also, refactor the the executable to now succeed with no output and
fails with an exit code.

- - - - -
5e251fa9 by Ben Gamari at 2023-01-27T10:04:19-05:00
testsuite: Make listThreads more robust

Previously it was sensitive to the labels of threads which it did not
create (e.g. the IO manager event loop threads). Fix this.

- - - - -
aea9da4c by Ben Gamari at 2023-01-27T10:04:19-05:00
rts: Fix non-atomic mutation of enabled_capabilities

- - - - -
cbc358ce by Ben Gamari at 2023-01-27T10:04:20-05:00
rts: Fix C++ compilation issues

Make the RTS compilable with a C++ compiler by inserting necessary
casts.

- - - - -
c7d27520 by Ben Gamari at 2023-01-27T10:04:20-05:00
rts: Fix typo

"tracingAddCapabilities" was mis-named

- - - - -
e30408fb by Ben Gamari at 2023-01-27T10:04:20-05:00
rts: Drop long-dead fallback definitions for INFINITY & NAN

These are no longer necessary since we now compile as C99.

- - - - -


26 changed files:

- compiler/GHC/Rename/Env.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Types/Error/Codes.hs
- distrib/configure.ac.in
- libraries/base/Data/Kind.hs
- libraries/base/Data/Void.hs
- libraries/base/tests/listThreads.hs
- − libraries/base/tests/listThreads.stdout
- rts/Messages.h
- rts/Schedule.c
- rts/Schedule.h
- rts/Trace.c
- rts/Trace.h
- rts/include/Rts.h
- rts/include/Stg.h
- rts/sm/NonMovingMark.h
- testsuite/config/ghc
- testsuite/tests/primops/should_run/UnliftedTVar2.hs
- − testsuite/tests/primops/should_run/UnliftedTVar2.stdout
- testsuite/tests/rename/should_fail/T14907b.stderr
- + testsuite/tests/rename/should_fail/T22839.hs
- + testsuite/tests/rename/should_fail/T22839.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/rename/should_fail/rnfail042.stderr
- testsuite/tests/th/T13968.stderr


Changes:

=====================================
compiler/GHC/Rename/Env.hs
=====================================
@@ -187,7 +187,7 @@ newTopSrcBinder (L loc rdr_name)
     if isExternalName name then
       do { this_mod <- getModule
          ; unless (this_mod == nameModule name)
-                  (addErrAt (locA loc) (badOrigBinding rdr_name))
+                  (addErrAt (locA loc) (TcRnBindingOfExistingName rdr_name))
          ; return name }
     else   -- See Note [Binders in Template Haskell] in "GHC.ThToHs"
       do { this_mod <- getModule
@@ -196,7 +196,7 @@ newTopSrcBinder (L loc rdr_name)
   | Just (rdr_mod, rdr_occ) <- isOrig_maybe rdr_name
   = do  { this_mod <- getModule
         ; unless (rdr_mod == this_mod || rdr_mod == rOOT_MAIN)
-                 (addErrAt (locA loc) (badOrigBinding rdr_name))
+                 (addErrAt (locA loc) (TcRnBindingOfExistingName rdr_name))
         -- When reading External Core we get Orig names as binders,
         -- but they should agree with the module gotten from the monad
         --
@@ -205,7 +205,7 @@ newTopSrcBinder (L loc rdr_name)
         -- the constructor is parsed as a type, and then GHC.Parser.PostProcess.tyConToDataCon
         -- uses setRdrNameSpace to make it into a data constructors.  At that point
         -- the nice Exact name for the TyCon gets swizzled to an Orig name.
-        -- Hence the badOrigBinding error message.
+        -- Hence the TcRnBindingOfExistingName error message.
         --
 
         -- MP 2022: I suspect this code path is never called for `rOOT_MAIN` anymore
@@ -2118,13 +2118,3 @@ lookupQualifiedDoName ctxt std_name
   = case qualifiedDoModuleName_maybe ctxt of
       Nothing -> lookupSyntaxName std_name
       Just modName -> lookupNameWithQualifier std_name modName
-
-
--- Error messages
-
-badOrigBinding :: RdrName -> TcRnMessage
-badOrigBinding name
-  | Just _ <- isBuiltInOcc_maybe occ = TcRnIllegalBindingOfBuiltIn occ
-  | otherwise = TcRnNameByTemplateHaskellQuote name
-  where
-    occ = rdrNameOcc $ filterCTuple name


=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -25,7 +25,7 @@ module GHC.Tc.Errors.Ppr
 import GHC.Prelude
 
 import GHC.Builtin.Names
-import GHC.Builtin.Types ( boxedRepDataConTyCon, tYPETyCon )
+import GHC.Builtin.Types ( boxedRepDataConTyCon, tYPETyCon, filterCTuple )
 
 import GHC.Core.Coercion
 import GHC.Core.Unify     ( tcMatchTys )
@@ -968,10 +968,6 @@ instance Diagnostic TcRnMessage where
       -> mkSimpleDecorated $
          text "You cannot SPECIALISE" <+> quotes (ppr name)
            <+> text "because its definition is not visible in this module"
-    TcRnNameByTemplateHaskellQuote name -> mkSimpleDecorated $
-      text "Cannot redefine a Name retrieved by a Template Haskell quote:" <+> ppr name
-    TcRnIllegalBindingOfBuiltIn name -> mkSimpleDecorated $
-       text "Illegal binding of built-in syntax:" <+> ppr name
     TcRnPragmaWarning {pragma_warning_occ, pragma_warning_msg, pragma_warning_import_mod, pragma_warning_defined_mod}
       -> mkSimpleDecorated $
         sep [ sep [ text "In the use of"
@@ -1238,6 +1234,8 @@ instance Diagnostic TcRnMessage where
               Left gbl_names -> vcat (map (\name -> quotes (ppr $ grePrintableName name) <+> pprNameProvenance name) gbl_names)
               Right lcl_name -> quotes (ppr lcl_name) <+> text "defined at"
                 <+> ppr (nameSrcLoc lcl_name)
+    TcRnBindingOfExistingName name -> mkSimpleDecorated $
+      text "Illegal binding of an existing name:" <+> ppr (filterCTuple name)
 
   diagnosticReason = \case
     TcRnUnknownMessage m
@@ -1552,10 +1550,6 @@ instance Diagnostic TcRnMessage where
       -> WarningWithoutFlag
     TcRnSpecialiseNotVisible{}
       -> WarningWithoutFlag
-    TcRnNameByTemplateHaskellQuote{}
-      -> ErrorWithoutFlag
-    TcRnIllegalBindingOfBuiltIn{}
-      -> ErrorWithoutFlag
     TcRnPragmaWarning{}
       -> WarningWithFlag Opt_WarnWarningsDeprecations
     TcRnIllegalHsigDefaultMethods{}
@@ -1646,6 +1640,8 @@ instance Diagnostic TcRnMessage where
       -> ErrorWithoutFlag
     TcRnCapturedTermName{}
       -> WarningWithFlag Opt_WarnTermVariableCapture
+    TcRnBindingOfExistingName{}
+      -> ErrorWithoutFlag
 
   diagnosticHints = \case
     TcRnUnknownMessage m
@@ -1962,10 +1958,6 @@ instance Diagnostic TcRnMessage where
       -> noHints
     TcRnSpecialiseNotVisible name
       -> [SuggestSpecialiseVisibilityHints name]
-    TcRnNameByTemplateHaskellQuote{}
-      -> noHints
-    TcRnIllegalBindingOfBuiltIn{}
-      -> noHints
     TcRnPragmaWarning{}
       -> noHints
     TcRnIllegalHsigDefaultMethods{}
@@ -2059,6 +2051,8 @@ instance Diagnostic TcRnMessage where
       -> [suggestExtension LangExt.TupleSections]
     TcRnCapturedTermName{}
       -> [SuggestRenameTypeVariable]
+    TcRnBindingOfExistingName{}
+      -> noHints
 
   diagnosticCode = constructorCode
 


=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -2193,32 +2193,6 @@ data TcRnMessage where
   -}
   TcRnSpecialiseNotVisible :: !Name -> TcRnMessage
 
-  {- TcRnNameByTemplateHaskellQuote is an error that occurs when one tries
-     to use a Template Haskell splice to define a top-level identifier with
-     an already existing name.
-
-     (See issue #13968 (closed) on GHC's issue tracker for more details)
-
-     Example(s):
-
-       $(pure [ValD (VarP 'succ) (NormalB (ConE 'True)) []])
-
-     Test cases:
-      T13968
-  -}
-  TcRnNameByTemplateHaskellQuote :: !RdrName -> TcRnMessage
-
-  {- TcRnIllegalBindingOfBuiltIn is an error that occurs when one uses built-in
-     syntax for data constructors or class names.
-
-     Use an OccName here because we don't want to print Prelude.(,)
-
-     Test cases:
-      rename/should_fail/T14907b
-      rename/should_fail/rnfail042
-  -}
-  TcRnIllegalBindingOfBuiltIn :: !OccName -> TcRnMessage
-
   {- TcRnPragmaWarning is a warning that can happen when usage of something
      is warned or deprecated by pragma.
 
@@ -2773,6 +2747,22 @@ data TcRnMessage where
   -}
   TcRnSectionWithoutParentheses :: HsExpr GhcPs -> TcRnMessage
 
+  {- TcRnBindingOfExistingName is an error triggered by an attempt to rebind
+     built-in syntax, punned list or tuple syntax, or a name quoted via Template Haskell.
+
+     Examples:
+
+       data []
+       data (->)
+       $(pure [ValD (VarP 'succ) (NormalB (ConE 'True)) []])
+
+     Test cases: rename/should_fail/T14907b
+                 rename/should_fail/T22839
+                 rename/should_fail/rnfail042
+                 th/T13968
+  -}
+  TcRnBindingOfExistingName :: RdrName -> TcRnMessage
+
   deriving Generic
 
 -- | Things forbidden in @type data@ declarations.


=====================================
compiler/GHC/Types/Error/Codes.hs
=====================================
@@ -468,8 +468,6 @@ type family GhcDiagnosticCode c = n | n -> c where
   GhcDiagnosticCode "TcRnNonOverloadedSpecialisePragma"             = 35827
   GhcDiagnosticCode "TcRnSpecialiseNotVisible"                      = 85337
   GhcDiagnosticCode "TcRnIllegalTypeOperatorDecl"                   = 50649
-  GhcDiagnosticCode "TcRnNameByTemplateHaskellQuote"                = 40027
-  GhcDiagnosticCode "TcRnIllegalBindingOfBuiltIn"                   = 69639
 
   GhcDiagnosticCode "TcRnIllegalHsigDefaultMethods"                 = 93006
   GhcDiagnosticCode "TcRnBadGenericMethod"                          = 59794
@@ -502,6 +500,7 @@ type family GhcDiagnosticCode c = n | n -> c where
   GhcDiagnosticCode "TcRnBadFamInstDecl"                            = 06206
   GhcDiagnosticCode "TcRnNotOpenFamily"                             = 06207
   GhcDiagnosticCode "TcRnCapturedTermName"                          = 54201
+  GhcDiagnosticCode "TcRnBindingOfExistingName"                     = 58805
 
   -- IllegalNewtypeReason
   GhcDiagnosticCode "DoesNotHaveSingleField"                        = 23517
@@ -607,6 +606,8 @@ type family GhcDiagnosticCode c = n | n -> c where
   -- no longer reports. These are collected below.
 
   GhcDiagnosticCode "Example outdated error"                        = 00000
+  GhcDiagnosticCode "TcRnNameByTemplateHaskellQuote"                = 40027
+  GhcDiagnosticCode "TcRnIllegalBindingOfBuiltIn"                   = 69639
 
 {- *********************************************************************
 *                                                                      *


=====================================
distrib/configure.ac.in
=====================================
@@ -90,6 +90,10 @@ AC_PATH_PROG(SedCmd,gsed sed,sed)
 dnl ** check for Python for testsuite driver
 FIND_PYTHON
 FP_PROG_FIND
+if test -z "$FindCmd"
+then
+    AC_MSG_ERROR([find is required.])
+fi
 
 XCODE_VERSION()
 


=====================================
libraries/base/Data/Kind.hs
=====================================
@@ -1,5 +1,4 @@
-{-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE Trustworthy, ExplicitNamespaces #-}
 
 -----------------------------------------------------------------------------
 -- |


=====================================
libraries/base/Data/Void.hs
=====================================
@@ -1,5 +1,4 @@
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE NoImplicitPrelude #-}
 
 -----------------------------------------------------------------------------
 -- |


=====================================
libraries/base/tests/listThreads.hs
=====================================
@@ -1,3 +1,6 @@
+import Data.Maybe
+import Control.Monad
+import qualified Data.Set as S
 import Control.Concurrent
 import Data.List (sort)
 import GHC.Conc.Sync
@@ -13,11 +16,14 @@ main = do
   mvar <- newEmptyMVar
   let mkThread n = do
         tid <- forkIO $ readMVar mvar
-        labelThread tid ("thread-"++show n)
+        let lbl = "thread-"++show n
+        labelThread tid lbl
+        return lbl
 
-  mapM_ mkThread [0..100]
+  expectedLabels <- S.fromList <$> mapM mkThread [0..100]
   threads <- listThreads
-  print $ length threads
-  print . sort =<< mapM threadLabel threads
+  labels <- S.fromList . catMaybes <$> mapM threadLabel threads
+  unless (S.null $ expectedLabels `S.difference` labels) $
+      putStrLn $ unlines [ "thread labels don't match", show expectedLabels, show labels ]
   putMVar mvar ()
 


=====================================
libraries/base/tests/listThreads.stdout deleted
=====================================
@@ -1,2 +0,0 @@
-102
-[Nothing,Just "thread-0",Just "thread-1",Just "thread-10",Just "thread-100",Just "thread-11",Just "thread-12",Just "thread-13",Just "thread-14",Just "thread-15",Just "thread-16",Just "thread-17",Just "thread-18",Just "thread-19",Just "thread-2",Just "thread-20",Just "thread-21",Just "thread-22",Just "thread-23",Just "thread-24",Just "thread-25",Just "thread-26",Just "thread-27",Just "thread-28",Just "thread-29",Just "thread-3",Just "thread-30",Just "thread-31",Just "thread-32",Just "thread-33",Just "thread-34",Just "thread-35",Just "thread-36",Just "thread-37",Just "thread-38",Just "thread-39",Just "thread-4",Just "thread-40",Just "thread-41",Just "thread-42",Just "thread-43",Just "thread-44",Just "thread-45",Just "thread-46",Just "thread-47",Just "thread-48",Just "thread-49",Just "thread-5",Just "thread-50",Just "thread-51",Just "thread-52",Just "thread-53",Just "thread-54",Just "thread-55",Just "thread-56",Just "thread-57",Just "thread-58",Just "thread-59",Just "thread-6",Just "thread-60",Just "thread-61",Just "thread-62",Just "thread-63",Just "thread-64",Just "thread-65",Just "thread-66",Just "thread-67",Just "thread-68",Just "thread-69",Just "thread-7",Just "thread-70",Just "thread-71",Just "thread-72",Just "thread-73",Just "thread-74",Just "thread-75",Just "thread-76",Just "thread-77",Just "thread-78",Just "thread-79",Just "thread-8",Just "thread-80",Just "thread-81",Just "thread-82",Just "thread-83",Just "thread-84",Just "thread-85",Just "thread-86",Just "thread-87",Just "thread-88",Just "thread-89",Just "thread-9",Just "thread-90",Just "thread-91",Just "thread-92",Just "thread-93",Just "thread-94",Just "thread-95",Just "thread-96",Just "thread-97",Just "thread-98",Just "thread-99"]


=====================================
rts/Messages.h
=====================================
@@ -10,6 +10,7 @@
 
 #include "Capability.h"
 #include "Updates.h" // for DEBUG_FILL_SLOP
+#include "Schedule.h" // for SCHED_INTERRUPTING
 #include "SMPClosureOps.h"
 
 #include "BeginPrivate.h"
@@ -26,8 +27,9 @@ INLINE_HEADER void
 doneWithMsgThrowTo (Capability *cap, MessageThrowTo *m)
 {
     // The message better be locked (unless we are running single-threaded,
-    // where we are a bit more lenient (#19075).
-    ASSERT(getNumCapabilities() == 1 || m->header.info == &stg_WHITEHOLE_info);
+    // where we are a bit more lenient (#19075) or we got here from
+    // deleteAllThreads() due to RTS shutdown).
+    ASSERT(getNumCapabilities() == 1 || m->header.info == &stg_WHITEHOLE_info || getSchedState() == SCHED_INTERRUPTING);
     IF_NONMOVING_WRITE_BARRIER_ENABLED {
       updateRemembSetPushMessageThrowTo(cap, m);
     }


=====================================
rts/Schedule.c
=====================================
@@ -2322,7 +2322,7 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS)
             // must be done before calling moreCapabilities(), because that
             // will emit events about creating the new capabilities and adding
             // them to existing capsets.
-            tracingAddCapapilities(n_capabilities, new_n_capabilities);
+            tracingAddCapabilities(n_capabilities, new_n_capabilities);
 #endif
 
             // Resize the capabilities array
@@ -2337,7 +2337,8 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS)
 
     // update n_capabilities before things start running
     if (new_n_capabilities > n_capabilities) {
-        RELAXED_STORE(&n_capabilities, enabled_capabilities = new_n_capabilities);
+        RELAXED_STORE(&n_capabilities, new_n_capabilities);
+        RELAXED_STORE(&enabled_capabilities, new_n_capabilities);
     }
 
     // We're done: release the original Capabilities


=====================================
rts/Schedule.h
=====================================
@@ -131,7 +131,7 @@ setRecentActivity(enum RecentActivity new_value)
 INLINE_HEADER enum RecentActivity
 getRecentActivity(void)
 {
-    return RELAXED_LOAD_ALWAYS(&recent_activity);
+    return (enum RecentActivity) RELAXED_LOAD_ALWAYS(&recent_activity);
 }
 
 extern bool heap_overflow;


=====================================
rts/Trace.c
=====================================
@@ -143,7 +143,7 @@ void flushTrace ()
     }
 }
 
-void tracingAddCapapilities (uint32_t from, uint32_t to)
+void tracingAddCapabilities (uint32_t from, uint32_t to)
 {
     if (eventlog_enabled) {
         moreCapEventBufs(from,to);


=====================================
rts/Trace.h
=====================================
@@ -28,12 +28,14 @@ void initTracing (void);
 void endTracing  (void);
 void freeTracing (void);
 void resetTracing (void);
-void tracingAddCapapilities (uint32_t from, uint32_t to);
+void tracingAddCapabilities (uint32_t from, uint32_t to);
 
 #endif /* TRACING */
 
 typedef StgWord32 CapsetID;
+#if !defined(__cplusplus)
 typedef StgWord16 CapsetType;
+#endif
 enum CapsetType { CapsetTypeCustom = CAPSET_TYPE_CUSTOM,
                   CapsetTypeOsProcess = CAPSET_TYPE_OSPROCESS,
                   CapsetTypeClockdomain = CAPSET_TYPE_CLOCKDOMAIN };


=====================================
rts/include/Rts.h
=====================================
@@ -167,7 +167,10 @@ void _warnFail(const char *filename, unsigned int linenum);
 #endif /* DEBUG */
 
 #if __STDC_VERSION__ >= 201112L
-#define GHC_STATIC_ASSERT(x, msg) static_assert((x), msg)
+// `_Static_assert` is provided by C11 but is deprecated and replaced by
+// `static_assert` in C23. Perhaps some day we should instead use the latter.
+// See #22777.
+#define GHC_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
 #else
 #define GHC_STATIC_ASSERT(x, msg)
 #endif


=====================================
rts/include/Stg.h
=====================================
@@ -82,27 +82,6 @@
    that depend on config info, such as __USE_FILE_OFFSET64 */
 #include <math.h>
 
-// On Solaris, we don't get the INFINITY and NAN constants unless we
-// #define _STDC_C99, and we can't do that unless we also use -std=c99,
-// because _STDC_C99 causes the headers to use C99 syntax (e.g. restrict).
-// We aren't ready for -std=c99 yet, so define INFINITY/NAN by hand using
-// the gcc builtins.
-#if !defined(INFINITY)
-#if defined(__GNUC__)
-#define INFINITY __builtin_inf()
-#else
-#error No definition for INFINITY
-#endif
-#endif
-
-#if !defined(NAN)
-#if defined(__GNUC__)
-#define NAN __builtin_nan("")
-#else
-#error No definition for NAN
-#endif
-#endif
-
 /* -----------------------------------------------------------------------------
    Useful definitions
    -------------------------------------------------------------------------- */
@@ -242,6 +221,8 @@
 #define STG_PRINTF_ATTR(fmt_arg, rest) GNUC3_ATTRIBUTE(format(printf, fmt_arg, rest))
 #endif
 
+#define STG_RESTRICT __restrict__
+
 #define STG_NORETURN GNU_ATTRIBUTE(__noreturn__)
 
 #define STG_MALLOC GNUC3_ATTRIBUTE(__malloc__)


=====================================
rts/sm/NonMovingMark.h
=====================================
@@ -63,7 +63,7 @@ INLINE_HEADER enum EntryType nonmovingMarkQueueEntryType(MarkQueueEnt *ent)
 {
     uintptr_t tag = (uintptr_t) ent->null_entry.p & TAG_MASK;
     ASSERT(tag <= MARK_ARRAY);
-    return tag;
+    return (enum EntryType) tag;
 }
 
 typedef struct {
@@ -155,7 +155,7 @@ void markQueueAddRoot(MarkQueue* q, StgClosure** root);
 
 void initMarkQueue(MarkQueue *queue);
 void freeMarkQueue(MarkQueue *queue);
-void nonmovingMark(struct MarkQueue_ *restrict queue);
+void nonmovingMark(struct MarkQueue_ *STG_RESTRICT queue);
 
 bool nonmovingTidyWeaks(struct MarkQueue_ *queue);
 void nonmovingTidyThreads(void);


=====================================
testsuite/config/ghc
=====================================
@@ -22,7 +22,7 @@ config.other_ways         = ['hpc',
                              'prof_hc_hb','prof_hb',
                              'prof_hd','prof_hy','prof_hr',
                              'sanity',
-                             'threaded1_ls', 'threaded2_hT', 'debug_numa',
+                             'threaded1_ls', 'threaded2_hT', 'threaded2_sanity', 'debug_numa',
                              'llvm', 'debugllvm',
                              'profllvm', 'profoptllvm', 'profthreadedllvm',
                              'debug',
@@ -99,6 +99,7 @@ config.way_flags = {
     'threaded1_ls' : ['-threaded', '-debug'],
     'threaded2'    : ['-O', '-threaded'],
     'threaded2_hT' : ['-O', '-threaded'],
+    'threaded2_sanity': ['-O', '-threaded', '-debug'],
     'hpc'          : ['-O', '-fhpc'],
     'prof_hc_hb'   : ['-O', '-prof', '-static', '-fprof-auto'],
     'prof_hb'      : ['-O', '-prof', '-static', '-fprof-auto'],
@@ -144,6 +145,7 @@ config.way_rts_flags = {
     'threaded1_ls' : ['-ls'],
     'threaded2'    : ['-N2', '-ls'],
     'threaded2_hT' : ['-N2', '-hT'],
+    'threaded2_sanity' : ['-N2', '-DS'],
     'hpc'          : [],
     'prof_hc_hb'   : ['-hc', '-hbvoid'],
     'prof_hb'      : ['-hb'],


=====================================
testsuite/tests/primops/should_run/UnliftedTVar2.hs
=====================================
@@ -7,6 +7,7 @@
 
 module Main where
 
+import Control.Monad
 import Data.Kind
 import GHC.Exts
 import GHC.IO
@@ -28,7 +29,12 @@ main = do
                     case readTVarIO# tvar s4 of
                       (# s5, U res #) ->
                         (# s5, ( I# r, I# res ) #)
-  print (x == y, x > 100000)
+  unless (x > 100000) $ do
+      print (x,y)
+      fail "not enough iterations"
+  unless (x <= y) $ do
+      print (x,y)
+      fail "mismatch"
 
 increment :: TVar# RealWorld U -> State# RealWorld -> (# State# RealWorld, Int #)
 increment tvar = go


=====================================
testsuite/tests/primops/should_run/UnliftedTVar2.stdout deleted
=====================================
@@ -1 +0,0 @@
-(True,True)


=====================================
testsuite/tests/rename/should_fail/T14907b.stderr
=====================================
@@ -1,9 +1,9 @@
 
-T14907b.hs:5:1: error: [GHC-69639]
-    Illegal binding of built-in syntax: ()
+T14907b.hs:5:1: error: [GHC-58805]
+    Illegal binding of an existing name: ()
 
-T14907b.hs:6:1: error: [GHC-69639]
-    Illegal binding of built-in syntax: (,)
+T14907b.hs:6:1: error: [GHC-58805]
+    Illegal binding of an existing name: (,)
 
-T14907b.hs:7:1: error: [GHC-69639]
-    Illegal binding of built-in syntax: (,,)
+T14907b.hs:7:1: error: [GHC-58805]
+    Illegal binding of an existing name: (,,)


=====================================
testsuite/tests/rename/should_fail/T22839.hs
=====================================
@@ -0,0 +1,5 @@
+module T22839 where
+
+data []
+
+data (->)


=====================================
testsuite/tests/rename/should_fail/T22839.stderr
=====================================
@@ -0,0 +1,6 @@
+
+T22839.hs:3:1: error: [GHC-58805]
+    Illegal binding of an existing name: []
+
+T22839.hs:5:1: error: [GHC-58805]
+    Illegal binding of an existing name: ->


=====================================
testsuite/tests/rename/should_fail/all.T
=====================================
@@ -183,3 +183,4 @@ test('T21605a', normal, compile_fail, [''])
 test('T21605b', normal, compile_fail, [''])
 test('T21605c', normal, compile_fail, [''])
 test('T21605d', normal, compile_fail, [''])
+test('T22839', normal, compile_fail, [''])


=====================================
testsuite/tests/rename/should_fail/rnfail042.stderr
=====================================
@@ -1,12 +1,12 @@
 
-rnfail042.hs:5:11: error: [GHC-69639]
-    Illegal binding of built-in syntax: ()
+rnfail042.hs:5:11: error: [GHC-58805]
+    Illegal binding of an existing name: ()
 
-rnfail042.hs:6:10: error: [GHC-69639]
-    Illegal binding of built-in syntax: (,,,)
+rnfail042.hs:6:10: error: [GHC-58805]
+    Illegal binding of an existing name: (,,,)
 
-rnfail042.hs:7:12: error: [GHC-69639]
-    Illegal binding of built-in syntax: []
+rnfail042.hs:7:12: error: [GHC-58805]
+    Illegal binding of an existing name: []
 
-rnfail042.hs:8:13: error: [GHC-69639]
-    Illegal binding of built-in syntax: :
+rnfail042.hs:8:13: error: [GHC-58805]
+    Illegal binding of an existing name: :


=====================================
testsuite/tests/th/T13968.stderr
=====================================
@@ -1,3 +1,3 @@
 
-T13968.hs:6:2: error: [GHC-40027]
-    Cannot redefine a Name retrieved by a Template Haskell quote: succ
+T13968.hs:6:2: error: [GHC-58805]
+    Illegal binding of an existing name: succ



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/26b820e5150e87b245816b50385e148bdccbb82b...e30408fbc2fee7866d3b360b2ea6a455c25292c1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/26b820e5150e87b245816b50385e148bdccbb82b...e30408fbc2fee7866d3b360b2ea6a455c25292c1
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/20230127/f7b49825/attachment-0001.html>


More information about the ghc-commits mailing list