Skip to content
Snippets Groups Projects
  1. Nov 26, 2021
  2. Nov 25, 2021
    • Greg Steuck's avatar
      Kill a use of %n format specifier · e2c48b98
      Greg Steuck authored and Marge Bot's avatar Marge Bot committed
      This format has been used as a security exploit vector for decades
      now.  Some operating systems (OpenBSD, Android, MSVC). It is targeted
      for removal in C2X standard:
      http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2834.htm
      
      This requires extending the debug message function to return the
      number of bytes written (like printf(3)), to permit %n format
      specifier in one in one invocation of statsPrintf() in
      report_summary().
      
      Implemented by Matthias Kilian (kili<AT>outback.escape.de)
      e2c48b98
    • Greg Steuck's avatar
      Permit multiple values in config_args for validate · 20101d9c
      Greg Steuck authored and Marge Bot's avatar Marge Bot committed
      The whitespace expansion should be permitted to pass multiple
      arguments to configure.
      20101d9c
    • Ilias Tsitsimpis's avatar
      Link against libatomic for 64-bit atomic operations · 774fc4d6
      Ilias Tsitsimpis authored and Marge Bot's avatar Marge Bot committed
      Some platforms (e.g., armel) require linking against libatomic for
      64-bit atomic operations.
      
      Fixes #20549
      774fc4d6
    • Sebastian Graf's avatar
      hadrian: Add `collect_stats` flavour transformer · bd92c9b2
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      This is useful for later consumption with
      https://gitlab.haskell.org/bgamari/ghc-utils/-/blob/master/ghc_timings.py
      bd92c9b2
    • Ben Gamari's avatar
      compiler: Mark GHC.Prelude as Haddock no-home · cafb1f99
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      This significantly improves Haddock documentation generated by nix.
      cafb1f99
    • sheaf's avatar
      Allow boring class declarations in hs-boot files · f27a63fe
      sheaf authored and Marge Bot's avatar Marge Bot committed
        There are two different ways of declaring a class in an hs-boot file:
      
          - a full declaration, where everything is written as it is
            in the .hs file,
          - an abstract declaration, where class methods and superclasses
            are left out.
      
        However, a declaration with no methods and a trivial superclass,
        such as:
      
          class () => C a
      
        was erroneously considered to be an abstract declaration, because
        the superclass is trivial.
        This is remedied by a one line fix in GHC.Tc.TyCl.tcClassDecl1.
      
        This patch also further clarifies the documentation around
        class declarations in hs-boot files.
      
        Fixes #20661, #20588.
      f27a63fe
    • Gergő Érdi's avatar
      Add `llvmOptLevel` to `DynFlags` (#20500) · b52a9a3f
      Gergő Érdi authored and Marge Bot's avatar Marge Bot committed
      b52a9a3f
    • Gergő Érdi's avatar
      Add specific optimization flag for Cmm control flow analysis (#20500) · be0a9470
      Gergő Érdi authored and Marge Bot's avatar Marge Bot committed
      be0a9470
    • Gergő Érdi's avatar
      Add specific optimization flag for fast PAP calls (#6084, #20500) · c9cead1f
      Gergő Érdi authored and Marge Bot's avatar Marge Bot committed
      c9cead1f
    • Gergő Érdi's avatar
      Use `simplify` in non-optimizing build pipeline (#20500) · cf5279ed
      Gergő Érdi authored and Marge Bot's avatar Marge Bot committed
      cf5279ed
    • Roland Senn's avatar
      GHCi Debugger - Improve RTTI · b24e8d91
      Roland Senn authored and Marge Bot's avatar Marge Bot committed
      When processing the heap, use also `APClosures` to create additional type
      constraints. This adds more equations and therefore improves the unification
      process to infer the correct type of values at breakpoints.
      (Fix the `incr` part of #19559)
      b24e8d91
    • mnislaih's avatar
      drop instance Semigroup InstalledModuleEnv · b742475a
      mnislaih authored and Marge Bot's avatar Marge Bot committed
      Instead, introduce plusInstalledModuleEnv
      b742475a
    • mnislaih's avatar
      Drop instance Semigroup ModuleEnv · 47f36440
      mnislaih authored and Marge Bot's avatar Marge Bot committed
      There is more than one possible Semigroup and it is not needed since plusModuleEnv can be used directly
      47f36440
    • mnislaih's avatar
      Monoid instance for InstalledModuleEnv · 52cdc2fe
      mnislaih authored and Marge Bot's avatar Marge Bot committed
      52cdc2fe
    • Ben Gamari's avatar
      gitlab-ci: Add release jobs for Darwin targets · 96b3899e
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      As noted in #20707, the validate jobs which we previously used lacked
      profiling support.
      
      Also clean up some variable definitions.
      
      Fixes #20707.
      96b3899e
    • Zubin's avatar
      testsuite: debounce title updates · 5428b8c6
      Zubin authored and Marge Bot's avatar Marge Bot committed
      5428b8c6
    • Greg Steuck's avatar
      Disable warnings for unused goto labels · 8961d632
      Greg Steuck authored and Marge Bot's avatar Marge Bot committed
      Clang on OpenBSD aborts compilation with this diagnostics:
      ```
      % "inplace/bin/ghc-stage1" -optc-Wno-error=unused-label -optc-Wall -optc-Werror -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-Wno-aggregate-return -optc-fno-strict-aliasing -optc-fno-common -optc-Irts/dist-install/build/./autogen -optc-Irts/include/../dist-install/build/include -optc-Irts/include/. -optc-Irts/. -optc-DCOMPILING_RTS -optc-DFS_NAMESPACE=rts -optc-Wno-unknown-pragmas -optc-O2 -optc-fomit-frame-pointer -optc-g -optc-DRtsWay=\"rts_v\" -static  -O0 -H64m -Wall -fllvm-fill-undef-with-garbage    -Werror -this-unit-id rts -dcmm-lint     -package-env - -i -irts -irts/dist-install/build -Irts/dist-install/build -irts/dist-install/build/./autogen -Irts/dist-install/build/./autogen -Irts/include/../dist-install/build/include -Irts/include/. -Irts/. -optP-DCOMPILING_RTS -optP-DFS_NAMESPACE=rts        -O2 -Wcpp-undef   -Wnoncanonical-monad-instances  -c rts/linker/Elf.c -o rts/dist-install/build/linker/Elf.o
      
      rts/linker/Elf.c:2169:1: error:
           error: unused label 'dl_iterate_phdr_fail' [-Werror,-Wunused-label]
           |
      2169 | dl_iterate_phdr_fail:
           | ^
      dl_iterate_phdr_fail:
      ^~~~~~~~~~~~~~~~~~~~~
      
      rts/linker/Elf.c:2172:1: error:
           error: unused label 'dlinfo_fail' [-Werror,-Wunused-label]
           |
      2172 | dlinfo_fail:
           | ^
      dlinfo_fail:
      ^~~~~~~~~~~~
      2 errors generated.
      ```
      8961d632
    • Matthew Pickering's avatar
      Don't use implicit lifting when deriving Lift · 4d34bf15
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      It isn't much more complicated to be more precise when deriving Lift so
      we now generate
      
      ```
      data Foo = Foo Int Bool
      
      instance Lift Foo where
        lift (Foo a b) = [| Foo $(lift a) $(lift b) |]
        liftTyped (Foo a b) = [|| Foo $$(lift a) $$(lift b) |]
      ```
      
      This fixes #20688 which complained about using implicit lifting in the
      derived code.
      4d34bf15
    • sheaf's avatar
      Add Data.Bits changes to base 4.16 changelog · d530c46c
      sheaf authored and Marge Bot's avatar Marge Bot committed
        Several additions since 4.15 had not been recorded in the changelog:
      
          - newtypes And, Ior, Xor and Iff,
          - oneBits
          - symbolic synonyms `.^.`, `.>>.`, `!>>.`, `.<<.` and `!<<.`.
      
        Fixes #20608.
      d530c46c
    • John Ericson's avatar
      Apply 1 suggestion(s) to 1 file(s) · c18a51f0
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      c18a51f0
    • Greg Steuck's avatar
      Reorder `sed` arguments to work with BSD sed · bb71f7f1
      Greg Steuck authored and Marge Bot's avatar Marge Bot committed
      The order was swapped in 490e8c75
      causing the build on OpenBSD to fail with:
      `sed: 1: "mk/config.h": invalid command code m`
      bb71f7f1
    • Krzysztof Gogolewski's avatar
      Misc cleanup · e33412d0
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      * Remove `getTag_RDR` (unused), `tidyKind` and `tidyOpenKind`
        (already available as `tidyType` and `tidyOpenType`)
      
      * Remove Note [Explicit Case Statement for Specificity].
        Since 0a709dd9 we require GHC 8.10 for bootstrapping.
      
      * Change the warning to `cmpAltCon` to a panic.
        This shouldn't happen.  If it ever does, the code was wrong anyway:
        it shouldn't always return `LT`, but rather `LT` in one case
        and `GT` in the other case.
      
      * Rename `verifyLinearConstructors` to `verifyLinearFields`
      
      * Fix `Note [Local record selectors]` which was not referenced
      
      * Remove vestiges of `type +v`
      
      * Minor fixes to StaticPointers documentation, part of #15603
      e33412d0
    • CarrieMY's avatar
      Enable UnboxedTuples in `genInst`, Fixes #20524 · 7c65687e
      CarrieMY authored and Marge Bot's avatar Marge Bot committed
      7c65687e
    • Christiaan Baaij's avatar
      Compare types of recursive let-bindings in alpha-equivalence · 3639ad8f
      Christiaan Baaij authored and Marge Bot's avatar Marge Bot committed
      This commit fixes #20641 by checking the types of recursive
      let-bindings when performing alpha-equality.
      
      The `Eq (DeBruijn CoreExpr)` instance now also compares
      `BreakPoint`s similarly to `GHC.Core.Utils.eqTickish`, taking
      bound variables into account.
      
      In addition, the `Eq (DeBruijn Type)` instance now correctly
      compares the kinds of the types when one of them contains a
      Cast: the instance is modeled after `nonDetCmpTypeX`.
      3639ad8f
    • Christiaan Baaij's avatar
      Ensure new Ct/evidence invariant · e3c59191
      Christiaan Baaij authored and Marge Bot's avatar Marge Bot committed
      The `ctev_pred` field of a `CtEvidence` is a just a cache for the type
      of the evidence.  More precisely:
      * For Givens, `ctev_pred` = `varType ctev_evar`
      * For Wanteds, `ctev_pred` = `evDestType ctev_dest`
      
      This new invariant is needed because evidence can become part of a
      type, via `Castty ty kco`.
      e3c59191
    • Greg Steuck's avatar
      Use getExecutablePath in getBaseDir on OpenBSD · baa8ffee
      Greg Steuck authored and Marge Bot's avatar Marge Bot committed
      While OpenBSD doesn't have a general mechanism for determining the
      path of the executing program image, it is reasonable to rely on
      argv[0] which happens as a fallback in getExecutablePath.
      
      With this change on top of T18173 we can get a bit close to fixing #18173.
      baa8ffee
    • Matthew Pickering's avatar
      Revert "Convert lookupIdSubst panic back to a warning (#20200)" · 6907e9fa
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This reverts commit df1d808f.
      6907e9fa
    • Matthew Pickering's avatar
      Make T14075 more robust · f0c5d8d3
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      f0c5d8d3
    • Matthew Pickering's avatar
      Correct retypechecking in --make mode · 91c0a657
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Note [Hydrating Modules]
      ~~~~~~~~~~~~~~~~~~~~~~~~
      
      What is hydrating a module?
      
      * There are two versions of a module, the ModIface is the on-disk version and the ModDetails is a fleshed-out in-memory version.
      * We can **hydrate** a ModIface in order to obtain a ModDetails.
      
      Hydration happens in three different places
      
      * When an interface file is initially loaded from disk, it has to be hydrated.
      * When a module is finished compiling, we hydrate the ModIface in order to generate
        the version of ModDetails which exists in memory (see Note)
      * When dealing with boot files and module loops (see Note [Rehydrating Modules])
      
      Note [Rehydrating Modules]
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      If a module has a boot file then it is critical to rehydrate the modules on
      the path between the two.
      
      Suppose we have ("R" for "recursive"):
      ```
      R.hs-boot:   module R where
                     data T
                     g :: T -> T
      
      A.hs:        module A( f, T, g ) where
                      import {-# SOURCE #-} R
                      data S = MkS T
                      f :: T -> S = ...g...
      
      R.hs:        module R where
                      data T = T1 | T2 S
                      g = ...f...
      ```
      
      After compiling A.hs we'll have a TypeEnv in which the Id for `f` has a type
      type uses the AbstractTyCon T; and a TyCon for `S` that also mentions that same
      AbstractTyCon. (Abstract because it came from R.hs-boot; we know nothing about
      it.)
      
      When compiling R.hs, we build a TyCon for `T`.  But that TyCon mentions `S`, and
      it currently has an AbstractTyCon for `T` inside it.  But we want to build a
      fully cyclic structure, in which `S` refers to `T` and `T` refers to `S`.
      
      Solution: **rehydration**.  *Before compiling `R.hs`*, rehydrate all the
      ModIfaces below it that depend on R.hs-boot.  To rehydrate a ModIface, call
      `typecheckIface` to convert it to a ModDetails.  It's just a de-serialisation
      step, no type inference, just lookups.
      
      Now `S` will be bound to a thunk that, when forced, will "see" the final binding
      for `T`; see [Tying the knot](https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/tying-the-knot).
      But note that this must be done *before* compiling R.hs.
      
      When compiling R.hs, the knot-tying stuff above will ensure that `f`'s unfolding
      mentions the `LocalId` for `g`.  But when we finish R, we carefully ensure that
      all those `LocalIds` are turned into completed `GlobalIds`, replete with
      unfoldings etc.   Alas, that will not apply to the occurrences of `g` in `f`'s
      unfolding. And if we leave matters like that, they will stay that way, and *all*
      subsequent modules that import A will see a crippled unfolding for `f`.
      
      Solution: rehydrate both R and A's ModIface together, right after completing R.hs.
      
      We only need rehydrate modules that are
      * Below R.hs
      * Above R.hs-boot
      
      There might be many unrelated modules (in the home package) that don't need to be
      rehydrated.
      
      This dark corner is the subject of #14092.
      
      Suppose we add to our example
      ```
      X.hs     module X where
                 import A
                 data XT = MkX T
                 fx = ...g...
      ```
      If in `--make` we compile R.hs-boot, then A.hs, then X.hs, we'll get a `ModDetails` for `X` that has an AbstractTyCon for `T` in the the argument type of `MkX`.  So:
      
      * Either we should delay compiling X until after R has beeen compiled.
      * Or we should rehydrate X after compiling R -- because it transitively depends on R.hs-boot.
      
      Ticket #20200 has exposed some issues to do with the knot-tying logic in GHC.Make, in `--make` mode.
      this particular issue starts [here](ghc/ghc#20200 (comment 385758)).
      
      The wiki page [Tying the knot](https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/tying-the-knot) is helpful.
      Also closely related are
          * #14092
          * #14103
      
      Fixes tickets #20200 #20561
      91c0a657
  3. Nov 24, 2021
    • Alex D's avatar
      Combine STG free variable traversals (#17978) · 16690374
      Alex D authored
      Previously we would traverse the STG AST twice looking for free variables.
       * Once in `annTopBindingsDeps` which considers top level and imported ids free.
         Its output is used to put bindings in dependency order. The pass happens
         in STG pipeline.
       * Once in `annTopBindingsFreeVars` which only considers non-top level ids free.
         Its output is used by the code generator to compute offsets into closures.
         This happens in Cmm (CodeGen) pipeline.
      
      Now these two traversal operations are merged into one - `FVs.depSortWithAnnotStgPgm`.
      The pass happens right at the end of STG pipeline. Some type signatures had to be
      updated due to slight shifts of StgPass boundaries (for example, top-level CodeGen
      handler now directly works with CodeGen flavoured Stg AST instead of Vanilla).
      
      Due to changed order of bindings, a few debugger type reconstruction bugs
      have resurfaced again (see tests break018, break021) - work item #18004 tracks this
      investigation.
      
      authors: simonpj, nineonine
      16690374
  4. Nov 23, 2021
  5. Nov 22, 2021
Loading