[Git][ghc/ghc][wip/backports-9.8] 7 commits: ci: Build debian12 and fedora38 bindists

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Sep 14 03:12:32 UTC 2023



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


Commits:
73da0164 by Matthew Pickering at 2023-09-13T23:11:55-04:00
ci: Build debian12 and fedora38 bindists

This adds builds for the latest releases for fedora and debian

We build these bindists in nightly and release pipelines.

(cherry picked from commit 8f7d3041e05496ab5eb30fb2a69ff61d5e13008a)

- - - - -
40183214 by Matthew Pickering at 2023-09-13T23:12:13-04:00
darwin: Bump MAXOSX_DEPLOYMENT_TARGET to 10.13

This bumps the minumum supported version to 10.13 (High Sierra) which is
6 years old at this point.

Fixes #22938

(cherry picked from commit 261b6747d4dada6ccdfb409513417489a495938c)

- - - - -
ff4e04ba by Matthew Craven at 2023-09-13T23:12:14-04:00
Unarise: Split Rubbish literals in function args

Fixes #23914.  Also adds a check to STG lint that
these args are properly unary or nullary after unarisation

(cherry picked from commit da30f0beb9e1820500382da02ffce96da959fa84)

- - - - -
9abe9917 by Josh Meredith at 2023-09-13T23:12:14-04:00
JS: Implement missing C functions `rename`, `realpath`, and `getcwd` (#23806)

(cherry picked from commit d07080d260075f2c00ec9a3752dbeda4f67ce439)

- - - - -
4db71327 by Matthew Pickering at 2023-09-13T23:12:14-04:00
Add -Winconsistent-flags warning

The warning fires when inconsistent command line flags are passed.

For example:

* -dynamic-too and -dynamic
* -dynamic-too on windows
* -O and --interactive
* etc

This is on by default and allows users to control whether the warning is
displayed and whether it should be an error or not.

Fixes #22572

(cherry picked from commit 21a906c28da497c2b8390de75270357a7f80e5a7)

- - - - -
74d6cddf by Finley McIlwaine at 2023-09-13T23:12:14-04:00
Fix numa auto configure

(cherry picked from commit 9217950baf0665c9ec71bdd5aa59710de6d8b31d)

- - - - -
866acfc5 by Ben Gamari at 2023-09-13T23:12:14-04:00
Bump text submodule to text-2.1

See #23758.

- - - - -


23 changed files:

- .gitlab-ci.yml
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/Stg/Unarise.hs
- compiler/GHC/Types/Literal.hs
- compiler/GHC/Types/RepType.hs
- docs/users_guide/9.8.1-notes.rst
- docs/users_guide/using-warnings.rst
- libraries/base/jsbits/base.js
- libraries/text
- m4/fp_find_libnuma.m4
- + testsuite/tests/core-to-stg/T23914.hs
- testsuite/tests/core-to-stg/all.T
- testsuite/tests/driver/T20436/T20436.stderr
- testsuite/tests/ghc-api/T10052/T10052.stderr
- testsuite/tests/ghc-api/downsweep/all.T
- testsuite/tests/ghci/should_fail/T10549.stderr
- testsuite/tests/rename/prog006/all.T
- testsuite/tests/th/T8333.stderr


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -2,7 +2,7 @@ variables:
   GIT_SSL_NO_VERIFY: "1"
 
   # Commit of ghc/ci-images repository from which to pull Docker images
-  DOCKER_REV: a9c0f5efbe503c17f63070583b2d815e498acc68
+  DOCKER_REV: 653b899f026f84c8043c76c014a5355d28cda24a
 
   # Sequential version number of all cached things.
   # Bump to invalidate GitLab CI cache.


=====================================
.gitlab/gen_ci.hs
=====================================
@@ -108,8 +108,12 @@ data Opsys
   | Windows deriving (Eq)
 
 data LinuxDistro
-  = Debian11 | Debian10 | Debian9
+  = Debian12
+  | Debian11
+  | Debian10
+  | Debian9
   | Fedora33
+  | Fedora38
   | Ubuntu2004
   | Ubuntu1804
   | Centos7
@@ -282,10 +286,12 @@ tags arch opsys _bc = [runnerTag arch opsys] -- Tag for which runners we can use
 -- These names are used to find the docker image so they have to match what is
 -- in the docker registry.
 distroName :: LinuxDistro -> String
+distroName Debian12  = "deb12"
 distroName Debian11  = "deb11"
 distroName Debian10   = "deb10"
 distroName Debian9   = "deb9"
 distroName Fedora33  = "fedora33"
+distroName Fedora38  = "fedora38"
 distroName Ubuntu1804 = "ubuntu18_04"
 distroName Ubuntu2004 = "ubuntu20_04"
 distroName Centos7    = "centos7"
@@ -404,7 +410,7 @@ opsysVariables AArch64 (Darwin {}) =
           ]
 opsysVariables Amd64 (Darwin {}) =
   mconcat [ "NIX_SYSTEM" =: "x86_64-darwin"
-          , "MACOSX_DEPLOYMENT_TARGET" =: "10.10"
+          , "MACOSX_DEPLOYMENT_TARGET" =: "10.13"
           -- "# Only Sierra and onwards supports clock_gettime. See #12858"
           , "ac_cv_func_clock_gettime" =: "no"
           -- # Only newer OS Xs support utimensat. See #17895
@@ -895,6 +901,7 @@ job_groups =
         (modifyValidateJobs manual (validateBuilds Amd64 (Linux Debian10) noTntc))
      , addValidateRule LLVMBackend (validateBuilds Amd64 (Linux Debian10) llvm)
      , disableValidate (standardBuilds Amd64 (Linux Debian11))
+     , disableValidate (standardBuilds Amd64 (Linux Debian12))
      -- We still build Deb9 bindists for now due to Ubuntu 18 and Linux Mint 19
      -- not being at EOL until April 2023 and they still need tinfo5.
      , disableValidate (standardBuildsWithConfig Amd64 (Linux Debian9) (splitSectionsBroken vanilla))
@@ -908,6 +915,7 @@ job_groups =
      -- This job is only for generating head.hackage docs
      , hackage_doc_job (disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig))
      , disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) dwarf)
+     , disableValidate (standardBuilds Amd64 (Linux Fedora38))
      , fastCI (standardBuildsWithConfig Amd64 Windows vanilla)
      , disableValidate (standardBuildsWithConfig Amd64 Windows nativeInt)
      , standardBuilds Amd64 Darwin


=====================================
.gitlab/jobs.yaml
=====================================
@@ -1,4 +1,3 @@
-### THIS IS A GENERATED FILE, DO NOT MODIFY DIRECTLY
 {
   "aarch64-darwin-validate": {
     "after_script": [
@@ -475,7 +474,7 @@
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi ",
       "HADRIAN_ARGS": "--docs=no-sphinx",
       "LANG": "en_US.UTF-8",
-      "MACOSX_DEPLOYMENT_TARGET": "10.10",
+      "MACOSX_DEPLOYMENT_TARGET": "10.13",
       "NIX_SYSTEM": "x86_64-darwin",
       "TEST_ENV": "x86_64-darwin-validate",
       "XZ_OPT": "-9",
@@ -1691,6 +1690,65 @@
       "XZ_OPT": "-9"
     }
   },
+  "nightly-x86_64-linux-deb12-validate": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "8 weeks",
+      "paths": [
+        "ghc-x86_64-linux-deb12-validate.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-deb12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-validate",
+      "BUILD_FLAVOUR": "validate",
+      "CONFIGURE_ARGS": "",
+      "TEST_ENV": "x86_64-linux-deb12-validate",
+      "XZ_OPT": "-9"
+    }
+  },
   "nightly-x86_64-linux-deb9-validate": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -1934,6 +1992,65 @@
       "XZ_OPT": "-9"
     }
   },
+  "nightly-x86_64-linux-fedora38-validate": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "8 weeks",
+      "paths": [
+        "ghc-x86_64-linux-fedora38-validate.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-fedora38-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora38:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora38-validate",
+      "BUILD_FLAVOUR": "validate",
+      "CONFIGURE_ARGS": "",
+      "TEST_ENV": "x86_64-linux-fedora38-validate",
+      "XZ_OPT": "-9"
+    }
+  },
   "nightly-x86_64-linux-rocky8-validate": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -2474,7 +2591,7 @@
       "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
       "IGNORE_PERF_FAILURES": "all",
       "LANG": "en_US.UTF-8",
-      "MACOSX_DEPLOYMENT_TARGET": "10.10",
+      "MACOSX_DEPLOYMENT_TARGET": "10.13",
       "NIX_SYSTEM": "x86_64-darwin",
       "TEST_ENV": "x86_64-darwin-release",
       "XZ_OPT": "-9",
@@ -2916,6 +3033,67 @@
       "XZ_OPT": "-9"
     }
   },
+  "release-x86_64-linux-deb12-release": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "1 year",
+      "paths": [
+        "ghc-x86_64-linux-deb12-release.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-deb12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB == \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-deb12-release",
+      "BUILD_FLAVOUR": "release",
+      "CONFIGURE_ARGS": "",
+      "HADRIAN_ARGS": "--hash-unit-ids",
+      "IGNORE_PERF_FAILURES": "all",
+      "TEST_ENV": "x86_64-linux-deb12-release",
+      "XZ_OPT": "-9"
+    }
+  },
   "release-x86_64-linux-deb9-release+no_split_sections": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -3166,6 +3344,67 @@
       "XZ_OPT": "-9"
     }
   },
+  "release-x86_64-linux-fedora38-release": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "1 year",
+      "paths": [
+        "ghc-x86_64-linux-fedora38-release.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-fedora38-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora38:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB == \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-fedora38-release",
+      "BUILD_FLAVOUR": "release",
+      "CONFIGURE_ARGS": "",
+      "HADRIAN_ARGS": "--hash-unit-ids",
+      "IGNORE_PERF_FAILURES": "all",
+      "TEST_ENV": "x86_64-linux-fedora38-release",
+      "XZ_OPT": "-9"
+    }
+  },
   "release-x86_64-linux-rocky8-release": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -3526,7 +3765,7 @@
       "CONFIGURE_ARGS": "--with-intree-gmp --with-system-libffi ",
       "HADRIAN_ARGS": "--docs=no-sphinx",
       "LANG": "en_US.UTF-8",
-      "MACOSX_DEPLOYMENT_TARGET": "10.10",
+      "MACOSX_DEPLOYMENT_TARGET": "10.13",
       "NIX_SYSTEM": "x86_64-darwin",
       "TEST_ENV": "x86_64-darwin-validate",
       "ac_cv_func_clock_gettime": "no",


=====================================
.gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
=====================================
@@ -23,8 +23,10 @@ def job_triple(job_name):
         'release-x86_64-linux-ubuntu18_04-release': 'x86_64-ubuntu18_04-linux',
         'release-x86_64-linux-fedora33-release+debug_info': 'x86_64-fedora33-linux-dwarf',
         'release-x86_64-linux-fedora33-release': 'x86_64-fedora33-linux',
+        'release-x86_64-linux-fedora38-release': 'x86_64-fedora38-linux',
         'release-x86_64-linux-fedora27-release': 'x86_64-fedora27-linux',
         'release-x86_64-linux-deb11-release': 'x86_64-deb11-linux',
+        'release-x86_64-linux-deb12-release': 'x86_64-deb12-linux',
         'release-x86_64-linux-deb10-release+debug_info': 'x86_64-deb10-linux-dwarf',
         'release-x86_64-linux-deb10-release': 'x86_64-deb10-linux',
         'release-x86_64-linux-deb9-release': 'x86_64-deb9-linux',


=====================================
compiler/GHC/Driver/Errors/Ppr.hs
=====================================
@@ -294,7 +294,7 @@ instance Diagnostic DriverMessage where
       -> ErrorWithoutFlag
     DriverInterfaceError reason -> diagnosticReason reason
     DriverInconsistentDynFlags {}
-      -> WarningWithoutFlag
+      -> WarningWithFlag Opt_WarnInconsistentFlags
     DriverSafeHaskellIgnoredExtension {}
       -> WarningWithoutFlag
     DriverPackageTrustIgnored {}


=====================================
compiler/GHC/Driver/Flags.hs
=====================================
@@ -650,6 +650,7 @@ data WarningFlag =
    | Opt_WarnMissingRoleAnnotations                  -- Since 9.8
    | Opt_WarnImplicitRhsQuantification               -- Since 9.8
    | Opt_WarnIncompleteExportWarnings                -- Since 9.8
+   | Opt_WarnInconsistentFlags                       -- Since 9.8
    deriving (Eq, Ord, Show, Enum)
 
 -- | Return the names of a WarningFlag
@@ -760,6 +761,7 @@ warnFlagNames wflag = case wflag of
   Opt_WarnMissingRoleAnnotations                  -> "missing-role-annotations" :| []
   Opt_WarnImplicitRhsQuantification               -> "implicit-rhs-quantification" :| []
   Opt_WarnIncompleteExportWarnings                -> "incomplete-export-warnings" :| []
+  Opt_WarnInconsistentFlags                       -> "inconsistent-flags" :| []
 
 -- -----------------------------------------------------------------------------
 -- Standard sets of warning options
@@ -898,7 +900,8 @@ standardWarnings -- see Note [Documenting warning flags]
         Opt_WarnUnicodeBidirectionalFormatCharacters,
         Opt_WarnGADTMonoLocalBinds,
         Opt_WarnLoopySuperclassSolve,
-        Opt_WarnTypeEqualityRequiresOperators
+        Opt_WarnTypeEqualityRequiresOperators,
+        Opt_WarnInconsistentFlags
       ]
 
 -- | Things you get with -W


=====================================
compiler/GHC/Stg/Lint.hs
=====================================
@@ -175,9 +175,34 @@ lintStgTopBindings platform logger diag_opts opts extra_vars this_mod unarised w
     lint_bind (StgTopLifted bind) = lintStgBinds TopLevel bind
     lint_bind (StgTopStringLit v _) = return [v]
 
-lintStgArg :: StgArg -> LintM ()
-lintStgArg (StgLitArg _) = return ()
-lintStgArg (StgVarArg v) = lintStgVar v
+lintStgConArg :: StgArg -> LintM ()
+lintStgConArg arg = do
+  unarised <- lf_unarised <$> getLintFlags
+  when unarised $ case typePrimRep_maybe (stgArgType arg) of
+    -- Note [Post-unarisation invariants], invariant 4
+    Just [_] -> pure ()
+    badRep   -> addErrL $
+      text "Non-unary constructor arg: " <> ppr arg $$
+      text "Its PrimReps are: " <> ppr badRep
+
+  case arg of
+    StgLitArg _ -> pure ()
+    StgVarArg v -> lintStgVar v
+
+lintStgFunArg :: StgArg -> LintM ()
+lintStgFunArg arg = do
+  unarised <- lf_unarised <$> getLintFlags
+  when unarised $ case typePrimRep_maybe (stgArgType arg) of
+    -- Note [Post-unarisation invariants], invariant 3
+    Just []  -> pure ()
+    Just [_] -> pure ()
+    badRep   -> addErrL $
+      text "Function arg is not unary or void: " <> ppr arg $$
+      text "Its PrimReps are: " <> ppr badRep
+
+  case arg of
+    StgLitArg _ -> pure ()
+    StgVarArg v -> lintStgVar v
 
 lintStgVar :: Id -> LintM ()
 lintStgVar id = checkInScope id
@@ -248,16 +273,13 @@ lintStgRhs rhs@(StgRhsCon _ con _ _ args _) = do
 
     lintConApp con args (pprStgRhs opts rhs)
 
-    mapM_ lintStgArg args
-    mapM_ checkPostUnariseConArg args
-
 lintStgExpr :: (OutputablePass a, BinderP a ~ Id) => GenStgExpr a -> LintM ()
 
 lintStgExpr (StgLit _) = return ()
 
 lintStgExpr e@(StgApp fun args) = do
   lintStgVar fun
-  mapM_ lintStgArg args
+  mapM_ lintStgFunArg args
   lintAppCbvMarks e
   lintStgAppReps fun args
 
@@ -275,11 +297,8 @@ lintStgExpr app@(StgConApp con _n args _arg_tys) = do
     opts <- getStgPprOpts
     lintConApp con args (pprStgExpr opts app)
 
-    mapM_ lintStgArg args
-    mapM_ checkPostUnariseConArg args
-
 lintStgExpr (StgOpApp _ args _) =
-    mapM_ lintStgArg args
+    mapM_ lintStgFunArg args
 
 lintStgExpr (StgLet _ binds body) = do
     binders <- lintStgBinds NotTopLevel binds
@@ -322,12 +341,14 @@ lintAlt GenStgAlt{ alt_con   = DataAlt _
     mapM_ checkPostUnariseBndr bndrs
     addInScopeVars bndrs (lintStgExpr rhs)
 
--- Post unarise check we apply constructors to the right number of args.
--- This can be violated by invalid use of unsafeCoerce as showcased by test
--- T9208
-lintConApp :: Foldable t => DataCon -> t a -> SDoc -> LintM ()
+lintConApp :: DataCon -> [StgArg] -> SDoc -> LintM ()
 lintConApp con args app = do
+    mapM_ lintStgConArg args
     unarised <- lf_unarised <$> getLintFlags
+
+    -- Post unarise check we apply constructors to the right number of args.
+    -- This can be violated by invalid use of unsafeCoerce as showcased by test
+    -- T9208; see also #23865
     when (unarised &&
           not (isUnboxedTupleDataCon con) &&
           length (dataConRuntimeRepStrictness con) /= length args) $ do
@@ -361,6 +382,8 @@ lintStgAppReps fun args = do
         = match_args actual_reps_left expected_reps_left
 
         -- Check for void rep which can be either an empty list *or* [VoidRep]
+           -- No, typePrimRep_maybe will never return a result containing VoidRep.
+           -- We should refactor to make this obvious from the types.
         | isVoidRep actual_rep && isVoidRep expected_rep
         = match_args actual_reps_left expected_reps_left
 
@@ -507,20 +530,6 @@ checkPostUnariseBndr bndr = do
           ppr bndr <> text " has " <> text unexpected <> text " type " <>
           ppr (idType bndr)
 
--- Arguments shouldn't have sum, tuple, or void types.
-checkPostUnariseConArg :: StgArg -> LintM ()
-checkPostUnariseConArg arg = case arg of
-    StgLitArg _ ->
-      return ()
-    StgVarArg id -> do
-      lf <- getLintFlags
-      when (lf_unarised lf) $
-        forM_ (checkPostUnariseId id) $ \unexpected ->
-          addErrL $
-            text "After unarisation, arg " <>
-            ppr id <> text " has " <> text unexpected <> text " type " <>
-            ppr (idType id)
-
 -- Post-unarisation args and case alt binders should not have unboxed tuple,
 -- unboxed sum, or void types. Return what the binder is if it is one of these.
 checkPostUnariseId :: Id -> Maybe String


=====================================
compiler/GHC/Stg/Unarise.hs
=====================================
@@ -356,20 +356,17 @@ Note [Post-unarisation invariants]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 STG programs after unarisation have these invariants:
 
-  * No unboxed sums at all.
+ 1. No unboxed sums at all.
 
-  * No unboxed tuple binders. Tuples only appear in return position.
+ 2. No unboxed tuple binders. Tuples only appear in return position.
 
-  * DataCon applications (StgRhsCon and StgConApp) don't have void arguments.
+ 3. Binders and literals always have zero (for void arguments) or one PrimRep.
+
+ 4. DataCon applications (StgRhsCon and StgConApp) don't have void arguments.
     This means that it's safe to wrap `StgArg`s of DataCon applications with
     `GHC.StgToCmm.Env.NonVoid`, for example.
 
-  * Similar to unboxed tuples, Note [Rubbish literals] of TupleRep may only
-    appear in return position.
-
-  * Alt binders (binders in patterns) are always non-void.
-
-  * Binders always have zero (for void arguments) or one PrimRep.
+ 5. Alt binders (binders in patterns) are always non-void.
 -}
 
 module GHC.Stg.Unarise (unarise) where
@@ -555,7 +552,7 @@ unariseExpr rho (StgCase scrut bndr alt_ty alts)
 
   -- See (3) of Note [Rubbish literals] in GHC.Types.Literal
   | StgLit lit <- scrut
-  , Just args' <- unariseRubbish_maybe lit
+  , Just args' <- unariseLiteral_maybe lit
   = elimCase rho args' bndr alt_ty alts
 
   -- general case
@@ -592,20 +589,24 @@ unariseUbxSumOrTupleArgs rho us dc args ty_args
   | otherwise
   = panic "unariseUbxSumOrTupleArgs: Constructor not a unboxed sum or tuple"
 
--- Doesn't return void args.
-unariseRubbish_maybe :: Literal -> Maybe [OutStgArg]
-unariseRubbish_maybe (LitRubbish torc rep)
+-- Returns @Nothing@ if the given literal is already unary (exactly
+-- one PrimRep).  Doesn't return void args.
+--
+-- This needs to exist because rubbish literals can have any representation.
+-- See also Note [Rubbish literals] in GHC.Types.Literal.
+unariseLiteral_maybe :: Literal -> Maybe [OutStgArg]
+unariseLiteral_maybe (LitRubbish torc rep)
   | [prep] <- preps
-  , not (isVoidRep prep)
+  , assert (not (isVoidRep prep)) True
   = Nothing   -- Single, non-void PrimRep. Nothing to do!
 
   | otherwise -- Multiple reps, possibly with VoidRep. Eliminate via elimCase
   = Just [ StgLitArg (LitRubbish torc (primRepToRuntimeRep prep))
-         | prep <- preps, not (isVoidRep prep) ]
+         | prep <- preps, assert (not (isVoidRep prep)) True ]
   where
-    preps = runtimeRepPrimRep (text "unariseRubbish_maybe") rep
+    preps = runtimeRepPrimRep (text "unariseLiteral_maybe") rep
 
-unariseRubbish_maybe _ = Nothing
+unariseLiteral_maybe _ = Nothing
 
 --------------------------------------------------------------------------------
 
@@ -1052,7 +1053,11 @@ unariseFunArg rho (StgVarArg x) =
     Just (MultiVal as)  -> as
     Just (UnaryVal arg) -> [arg]
     Nothing             -> [StgVarArg x]
-unariseFunArg _ arg = [arg]
+unariseFunArg _ arg@(StgLitArg lit) = case unariseLiteral_maybe lit of
+  -- forgetting to unariseLiteral_maybe here caused #23914
+  Just [] -> [voidArg]
+  Just as -> as
+  Nothing -> [arg]
 
 unariseFunArgs :: UnariseEnv -> [StgArg] -> [StgArg]
 unariseFunArgs = concatMap . unariseFunArg
@@ -1078,7 +1083,7 @@ unariseConArg rho (StgVarArg x) =
                                      -- is a void, and so should be eliminated
       | otherwise -> [StgVarArg x]
 unariseConArg _ arg@(StgLitArg lit)
-  | Just as <- unariseRubbish_maybe lit
+  | Just as <- unariseLiteral_maybe lit
   = as
   | otherwise
   = assert (not (isZeroBitTy (literalType lit))) -- We have no non-rubbish void literals


=====================================
compiler/GHC/Types/Literal.hs
=====================================
@@ -1006,8 +1006,9 @@ data type. Here are the moving parts:
    take apart a case scrutinisation on, or arg occurrence of, e.g.,
    `RUBBISH[TupleRep[IntRep,DoubleRep]]` (which may stand in for `(# Int#, Double# #)`)
    into its sub-parts `RUBBISH[IntRep]` and `RUBBISH[DoubleRep]`, similar to
-   unboxed tuples. `RUBBISH[VoidRep]` is erased.
-   See 'unariseRubbish_maybe' and also Note [Post-unarisation invariants].
+   unboxed tuples.
+
+   See 'unariseLiteral_maybe' and also Note [Post-unarisation invariants].
 
 4. Cmm: We translate 'LitRubbish' to their actual rubbish value in 'cgLit'.
    The particulars are boring, and only matter when debugging illicit use of


=====================================
compiler/GHC/Types/RepType.hs
=====================================
@@ -607,8 +607,10 @@ kindPrimRep_maybe ki
   = pprPanic "kindPrimRep" (ppr ki)
 
 -- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that
--- it encodes. See also Note [Getting from RuntimeRep to PrimRep]
--- The [PrimRep] is the final runtime representation /after/ unarisation
+-- it encodes. See also Note [Getting from RuntimeRep to PrimRep].
+-- The @[PrimRep]@ is the final runtime representation /after/ unarisation.
+--
+-- The result does not contain any VoidRep.
 runtimeRepPrimRep :: HasDebugCallStack => SDoc -> RuntimeRepType -> [PrimRep]
 runtimeRepPrimRep doc rr_ty
   | Just rr_ty' <- coreView rr_ty
@@ -620,9 +622,11 @@ runtimeRepPrimRep doc rr_ty
   = pprPanic "runtimeRepPrimRep" (doc $$ ppr rr_ty)
 
 -- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that
--- it encodes. See also Note [Getting from RuntimeRep to PrimRep]
--- The [PrimRep] is the final runtime representation /after/ unarisation
--- Returns Nothing if rep can't be determined. Eg. levity polymorphic types.
+-- it encodes. See also Note [Getting from RuntimeRep to PrimRep].
+-- The @[PrimRep]@ is the final runtime representation /after/ unarisation
+-- and does not contain VoidRep.
+--
+-- Returns @Nothing@ if rep can't be determined. Eg. levity polymorphic types.
 runtimeRepPrimRep_maybe :: Type -> Maybe [PrimRep]
 runtimeRepPrimRep_maybe rr_ty
   | Just rr_ty' <- coreView rr_ty


=====================================
docs/users_guide/9.8.1-notes.rst
=====================================
@@ -208,6 +208,10 @@ Compiler
   by default for now whilst we consider more carefully an appropiate fix.
   (See :ghc-ticket:`23469`, :ghc-ticket:`23109`, :ghc-ticket:`21229`, :ghc-ticket:`23445`)
 
+- The warning about incompatible command line flags can now be controlled with the
+  :ghc-flag:`-Winconsistent-flags`. In particular this allows you to silence a warning
+  when using optimisation flags with :ghc-flag:`--interactive` mode.
+
 GHCi
 ~~~~
 


=====================================
docs/users_guide/using-warnings.rst
=====================================
@@ -78,6 +78,7 @@ as ``-Wno-...`` for every individual warning in the group.
         * :ghc-flag:`-Wforall-identifier`
         * :ghc-flag:`-Wgadt-mono-local-binds`
         * :ghc-flag:`-Wtype-equality-requires-operators`
+        * :ghc-flag:`-Winconsistent-flags`
 
 .. ghc-flag:: -W
     :shortdesc: enable normal warnings
@@ -2426,7 +2427,7 @@ of ``-W(no-)*``.
     :reverse: -Wno-role-annotations-signatures
     :category:
 
-    :since: 9.8
+    :since: 9.8.1
     :default: off
 
     .. index::
@@ -2448,7 +2449,7 @@ of ``-W(no-)*``.
     :reverse: -Wno-implicit-rhs-quantification
     :category:
 
-    :since: 9.8
+    :since: 9.8.1
     :default: off
 
     In accordance with `GHC Proposal #425
@@ -2465,9 +2466,6 @@ of ``-W(no-)*``.
 
     This warning detects code that will be affected by this breaking change.
 
-If you're feeling really paranoid, the :ghc-flag:`-dcore-lint` option is a good choice.
-It turns on heavyweight intra-pass sanity-checking within GHC. (It checks GHC's
-sanity, not yours.)
 
 .. ghc-flag:: -Wincomplete-export-warnings
     :shortdesc: warn when some but not all of exports for a name are warned about
@@ -2496,5 +2494,45 @@ sanity, not yours.)
           )
         import A
 
+<<<<<<< HEAD
      When :ghc-flag:`-Wincomplete-export-warnings` is enabled, GHC warns about exports 
-     that are not deprecating a name that is deprecated with another export in that module.
\ No newline at end of file
+     that are not deprecating a name that is deprecated with another export in that module.
+=======
+     When :ghc-flag:`-Wincomplete-export-warnings` is enabled, GHC warns about exports
+     that are not deprecating a name that is deprecated with another export in that module.
+
+.. ghc-flag:: -Wbadly-staged-types
+    :shortdesc: warn when type binding is used at the wrong TH stage.
+    :type: dynamic
+    :reverse: -Wno-badly-staged-types
+
+    :since: 9.10.1
+
+    Consider an example: ::
+
+        tardy :: forall a. Proxy a -> IO Type
+        tardy _ = [t| a |]
+
+    The type binding ``a`` is bound at stage 1 but used on stage 2.
+
+    This is badly staged program, and the ``tardy (Proxy @Int)`` won't produce
+    a type representation of ``Int``, but rather a local name ``a``.
+
+.. ghc-flag:: -Winconsistent-flags
+    :shortdesc: warn when command line options are inconsistent in some way.
+    :type: dynamic
+    :reverse: -Wno-inconsistent-flags
+
+    :since: 9.8.1
+    :default: on
+
+    Warn when command line options are inconsistent in some way.
+
+    For example, when using GHCi, optimisation flags are ignored and a warning is
+    issued. Another example is :ghc-flag:`-dynamic` is ignored when :ghc-flag:`-dynamic-too`
+    is passed.
+
+If you're feeling really paranoid, the :ghc-flag:`-dcore-lint` option is a good choice.
+It turns on heavyweight intra-pass sanity-checking within GHC. (It checks GHC's
+sanity, not yours.)
+>>>>>>> 21a906c28d (Add -Winconsistent-flags warning)


=====================================
libraries/base/jsbits/base.js
=====================================
@@ -246,6 +246,60 @@ function h$base_lstat(file, file_off, stat, stat_off, c) {
 #endif
         h$unsupported(-1, c);
 }
+
+function h$rename(old_path, old_path_off, new_path, new_path_off) {
+  TRACE_IO("rename")
+#ifndef GHCJS_BROWSER
+  if (h$isNode()) {
+    try {
+      fs.renameSync(h$decodeUtf8z(old_path, old_path_off), h$decodeUtf8z(new_path, new_path_off));
+      return 0;
+    } catch(e) {
+      h$setErrno(e);
+      return -1;
+    }
+  } else
+#endif
+    h$unsupported(-1);
+}
+
+function h$getcwd(buf, off, buf_size) {
+  TRACE_IO("getcwd")
+#ifndef GHCJS_BROWSER
+  if (h$isNode()) {
+    try {
+      var cwd = h$encodeUtf8(process.cwd());
+      h$copyMutableByteArray(cwd, 0, buf, off, cwd.len);
+      RETURN_UBX_TUP2(cwd, 0);
+    } catch (e) {
+      h$setErrno(e);
+      return -1;
+    }
+  } else
+#endif
+    h$unsupported(-1);
+}
+
+function h$realpath(path,off,resolved,resolved_off) {
+  TRACE_IO("realpath")
+#ifndef GHCJS_BROWSER
+  if (h$isNode()) {
+    try {
+      var rp = h$encodeUtf8(fs.realpathSync(h$decodeUtf8z(path,off)));
+      if (resolved !== null) {
+        h$copyMutableByteArray(rp, 0, resolved, resolved_off, Math.min(resolved.len - resolved_off, rp.len));
+        RETURN_UBX_TUP2(resolved, resolved_off);
+      }
+      RETURN_UBX_TUP2(rp, 0);
+    } catch (e) {
+      h$setErrno(e);
+      return -1;
+    }
+  } else
+#endif
+    h$unsupported(-1);
+}
+
 function h$base_open(file, file_off, how, mode, c) {
   return h$open(file,file_off,how,mode,c);
 }


=====================================
libraries/text
=====================================
@@ -1 +1 @@
-Subproject commit 9fc523cef77f02c465afe00a2f4ac67c388f9945
+Subproject commit 73620de89d43ee50de2d15b7bc0843bf6d6e9b9a


=====================================
m4/fp_find_libnuma.m4
=====================================
@@ -30,7 +30,7 @@ AC_DEFUN([FP_FIND_LIBNUMA],
           [Enable NUMA memory policy and thread affinity support in the
            runtime system via numactl's libnuma [default=auto]])])
 
-  if test "$enable_numa" = "yes" ; then
+  if test "$enable_numa" != "no" ; then
     CFLAGS2="$CFLAGS"
     CFLAGS="$LIBNUMA_CFLAGS $CFLAGS"
     LDFLAGS2="$LDFLAGS"
@@ -41,7 +41,7 @@ AC_DEFUN([FP_FIND_LIBNUMA],
     if test "$ac_cv_header_numa_h$ac_cv_header_numaif_h" = "yesyes" ; then
       AC_CHECK_LIB(numa, numa_available,HaveLibNuma=1)
     fi
-    if test "$HaveLibNuma" = "0" ; then
+    if test "$enable_numa:$HaveLibNuma" = "yes:0" ; then
         AC_MSG_ERROR([Cannot find system libnuma (required by --enable-numa)])
     fi
 


=====================================
testsuite/tests/core-to-stg/T23914.hs
=====================================
@@ -0,0 +1,18 @@
+{-# LANGUAGE UnboxedTuples #-}
+module T23914 where
+
+type Registers = (# (), () #)
+
+p :: Registers -> ()
+p x = control0 () x
+
+control0 :: () -> Registers -> ()
+control0 x = controlWithMode x
+{-# SCC control0 #-}
+
+controlWithMode :: () -> Registers -> ()
+controlWithMode x = thro x
+{-# SCC controlWithMode #-}
+
+thro :: () -> Registers -> ()
+thro x y = thro x y


=====================================
testsuite/tests/core-to-stg/all.T
=====================================
@@ -1,3 +1,4 @@
 # Tests for CorePrep and CoreToStg
 
 test('T19700', normal, compile, ['-O'])
+test('T23914', normal, compile, ['-O'])


=====================================
testsuite/tests/driver/T20436/T20436.stderr
=====================================
@@ -1,3 +1,3 @@
 
-when making flags consistent: warning: [GHC-74335]
+when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags (in -Wdefault)]
     -dynamic-too is ignored when using -dynamic


=====================================
testsuite/tests/ghc-api/T10052/T10052.stderr
=====================================
@@ -1,3 +1,3 @@
 
-when making flags consistent: warning: [GHC-74335]
+when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags]
     Ignoring optimization flags since they are experimental for the byte-code interpreter. Pass -fno-unoptimized-core-for-interpreter to enable this feature.


=====================================
testsuite/tests/ghc-api/downsweep/all.T
=====================================
@@ -8,7 +8,6 @@ test('PartialDownsweep',
 
 test('OldModLocation',
      [ extra_run_opts('"' + config.libdir + '"')
-     , js_broken(22362)
      , when(opsys('mingw32'), expect_broken(16772))
      ],
      compile_and_run,


=====================================
testsuite/tests/ghci/should_fail/T10549.stderr
=====================================
@@ -1,2 +1,3 @@
-when making flags consistent: warning: [GHC-74335]
+
+when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags (in -Wdefault)]
     Ignoring optimization flags since they are experimental for the byte-code interpreter. Pass -fno-unoptimized-core-for-interpreter to enable this feature.


=====================================
testsuite/tests/rename/prog006/all.T
=====================================
@@ -1 +1 @@
-test('rn.prog006', [extra_files(['A.hs', 'B/', 'Main.hs', 'pwd.hs']), js_broken(22261)], makefile_test, [])
+test('rn.prog006', [extra_files(['A.hs', 'B/', 'Main.hs', 'pwd.hs'])], makefile_test, [])


=====================================
testsuite/tests/th/T8333.stderr
=====================================
@@ -1,3 +1,3 @@
 
-when making flags consistent: warning: [GHC-74335]
+when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags (in -Wdefault)]
     Ignoring optimization flags since they are experimental for the byte-code interpreter. Pass -fno-unoptimized-core-for-interpreter to enable this feature.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/661e7fca0bf480661e74ee48b35cc32fa872307b...866acfc5fa0b8f83f7159946af38060c7ceac816

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/661e7fca0bf480661e74ee48b35cc32fa872307b...866acfc5fa0b8f83f7159946af38060c7ceac816
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/20230913/4669f779/attachment-0001.html>


More information about the ghc-commits mailing list