1. 04 Feb, 2018 3 commits
    • Ben Gamari's avatar
      Bump transformers submodule to 0.5.5.0 · 111737cd
      Ben Gamari authored
      (cherry picked from commit 24e56ebd)
      111737cd
    • Ben Gamari's avatar
      testsuite: Add testcase for #14754 · 054abe3d
      Ben Gamari authored
      (cherry picked from commit 606edbfb)
      054abe3d
    • Ben Gamari's avatar
      cmm: Revert more aggressive CBE due to #14226 · f0cae1f2
      Ben Gamari authored
      Trac #14226 noted that the C-- CBE pass frequently fails to
      common up semantically identical blocks due to the differences in local
      register naming. These patches fixed this by making the pass consider
      equality up to alpha-renaming.
      
      However, the new logic failed to consider the possibility that local
      register naming *may* matter across multiple blocks. This lead to the
      regression #14754. I'll need to do a bit of thinking on a proper
      solution to this but in the meantime I'm reverting all four patches.
      
      This reverts commit a27056f9.
      This reverts commit 6f990c54.
      This reverts commit 9aa73892.
      This reverts commit 7920a7d9.
      
      (cherry picked from commit 50adbd7c)
      f0cae1f2
  2. 03 Feb, 2018 7 commits
    • Ben Gamari's avatar
      Bump stm submodule to 2.4.5.0 · 5acecda0
      Ben Gamari authored
      5acecda0
    • Ben Gamari's avatar
      integer-gmp: Simplify gmp/configure invocation · 89830a34
      Ben Gamari authored
      There weas lots of historical cruft to be found here. The `export
      SHELLOPTS` breaks on NixOS due to bash syntax in the gcc wrapper script.
      
      Reviewers: hvr
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4347
      
      (cherry picked from commit 3441b145)
      89830a34
    • Ryan Scott's avatar
      Don't apply dataToTag's caseRules for data families · b7f9139c
      Ryan Scott authored
      Commit 193664d4 added a
      special caseRule for `dataToTag`, but this transformation completely
      broke when `dataToTag` was applied to somewith with a type headed by
      a data family, leading to #14680. For now at least, the simplest
      solution is to simply not apply this transformation when the type is
      headed by a data family.
      
      Test Plan: make test TEST=T14680
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14680
      
      Differential Revision: https://phabricator.haskell.org/D4371
      
      (cherry picked from commit d8a0e6d3)
      b7f9139c
    • Ben Gamari's avatar
      ghc-prim: Emulate C11 atomics when not available · 7a3a7ee9
      Ben Gamari authored
      GCC's __sync primitives apparently "usually" imply a full barrier,
      meaning they can be used to emulate the more precise C11 atomics albeit
      with a loss of efficiency. This restores compatibility with GCC 4.4.
      
      This partially reverts commit 59de2909.
      
      Test Plan: Validate on Centos
      
      Reviewers: hvr, simonmar, trommler
      
      Subscribers: rwbarton, thomie, erikd, carter
      
      GHC Trac Issues: #14244
      
      Differential Revision: https://phabricator.haskell.org/D4364
      
      (cherry picked from commit 217e4170)
      7a3a7ee9
    • David Feuer's avatar
      Upgrade containers submodule · 445554b6
      David Feuer authored
      Reviewers: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4340
      
      (cherry picked from commit fdf518c7)
      445554b6
    • Alec Theriault's avatar
      Option for LINE pragmas to get lexed into tokens · 0e073e55
      Alec Theriault authored
      This adds a parser-level switch to have 'LINE' and 'COLUMN'
      pragmas lexed into actual tokens (as opposed to updating the
      position information in the parser).
      
      'lexTokenStream' is the only place where this option is enabled.
      
      Reviewers: bgamari, alexbiehl, mpickering
      
      Reviewed By: mpickering
      
      Subscribers: alanz, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4336
      
      (cherry picked from commit 9a57cfeb)
      0e073e55
    • Alec Theriault's avatar
      Haddock needs to pass visible modules for instance filtering · 42a82cf4
      Alec Theriault authored
      The GHC-side `getNameToInstancesIndex` filters out incorrectly some
      instances because it is not aware of what modules are visible. Using
      `runTcInteractive` means that `ie_visible` gets initialized to a one
      module set containing some dummy GHCi module. This is clearly not the
      module set we want to check against to see if a given orphan instance
      is visible or not.
      
      In fact, GHC has no way of knowing what we want that module set to be
      since it doesn't know ahead of time which modules Haddock is making its
      docs for. The fix is just to pass that set in as an argument.
      
      Bumps haddock submodule.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: duog, alexbiehl, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4290
      
      (cherry picked from commit a47438e88e685971a81874565f2914043c8233c3)
      42a82cf4
  3. 01 Feb, 2018 9 commits
    • Ben Gamari's avatar
      testsuite: Fix test output broken by efba0546 · 233c5ced
      Ben Gamari authored
      Looks right to me.
      
      (cherry picked from commit 7d9812e8)
      233c5ced
    • Ben Gamari's avatar
      testsuite: Fix test output of T14715 · d6f2f231
      Ben Gamari authored
      Arguably the warning should just be disabled for this test to eliminate
      unnecessary wiggle in the future.
      
      (cherry picked from commit fe6fdf68)
      d6f2f231
    • Julian Priestley's avatar
      Don't add targets that can't be found in GHCi · 8f668bda
      Julian Priestley authored
      When using the :add command in haxlsh/ghci, a module/file that can't
      be found is still added to the list of targets, resulting in an error
      message for the bad module/file for every subsequent usage of the
      command. The add command should verify that the module/file can be
      found before adding it to the list of targets.
      
      Also add a ":show targets" command to show the currently added list of
      commands, and an ":unadd" command to remove a target.
      
      Test Plan:
      Add a new GHCi testcase that checks that :add doesn't remember either
      files or modules that could not be found, and that both the new :show
      and :unadd commands work as expected.
      
      Reviewers: simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14676
      
      Differential Revision: https://phabricator.haskell.org/D4321
      
      (cherry picked from commit 0bff9e67)
      8f668bda
    • Andreas Klebinger's avatar
      Mark xmm6 as caller saved in the register allocator for windows. · fe485f29
      Andreas Klebinger authored
      This prevents the register being picked up as a scratch register.
      Otherwise the allocator would be free to use it before a call. This
      fixes #14619.
      
      Test Plan: ci, repro case on #14619
      
      Reviewers: bgamari, Phyx, erikd, simonmar, RyanGlScott, simonpj
      
      Reviewed By: Phyx, RyanGlScott, simonpj
      
      Subscribers: simonpj, RyanGlScott, Phyx, rwbarton, thomie, carter
      
      GHC Trac Issues: #14619
      
      Differential Revision: https://phabricator.haskell.org/D4348
      
      (cherry picked from commit add4e1f1)
      fe485f29
    • Ben Gamari's avatar
      rts: Ensure that forkOS releases Task on termination · f026b1c7
      Ben Gamari authored
      Test Plan: validate
      
      Reviewers: simonmar, erikd
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14725
      
      Differential Revision: https://phabricator.haskell.org/D4346
      
      (cherry picked from commit 382c12d1)
      f026b1c7
    • Ben Gamari's avatar
      SysTools: Add detection support for LLD linker · 2d1f6af4
      Ben Gamari authored
      I noticed while trying to test against LLVM 5.0 that GHC would throw "Couldn't
      figure out linker information" warnings due to LLD being chosen by configure.
      Adding detection support to silence these is simple enough, let's just do it.
      
      (cherry picked from commit 6c0db98b)
      2d1f6af4
    • Simon Peyton Jones's avatar
      Look inside implications in simplifyRule · d3573e4a
      Simon Peyton Jones authored
      Trac #14732 was a perpelexing bug in which -fdefer-typed-holes
      caused a mysterious type error in a RULE.  This turned out to
      be because we are more aggressive about creating implications
      when deferring (see TcUnify.implicationNeeded), and the rule
      mechanism hadn't caught up.
      
      This fixes it.
      
      (cherry picked from commit e9ae0cae)
      d3573e4a
    • Simon Peyton Jones's avatar
      Prioritise equalities when solving, incl deriveds · 77cdf60c
      Simon Peyton Jones authored
      We already prioritise equalities when solving, but
      Trac #14723 showed that we were not doing so consistently
      enough, and as a result the type checker could go into a loop.
      Yikes.
      
      See Note [Prioritise equalities] in TcSMonad.
      
      Fixng this bug changed the solve order enough to demonstrate
      a problem with fundeps: Trac #14745.
      
      (cherry picked from commit efba0546)
      77cdf60c
    • Simon Peyton Jones's avatar
      Move zonkWC to the right place in simplfyInfer · e6c14744
      Simon Peyton Jones authored
      runTcSWithEvBinds does some unification, so the zonkWC
      must be after, not before!  Yikes.  An outright bug.
      
      This fixes Trac #14715.
      
      (cherry picked from commit e7c3878d)
      e6c14744
  4. 29 Jan, 2018 4 commits
    • Ben Gamari's avatar
      Bump pretty submodule · 0c4d9e98
      Ben Gamari authored
      0c4d9e98
    • Ryan Scott's avatar
      Fix #14719 by using the setting the right SrcSpan · c60c6590
      Ryan Scott authored
      Currently, error messages that germane to GADT constructors
      put the source span at only the first character in the constructor,
      leading to insufficient caret diagnostics. This can be easily fixed
      by using a source span that spans the entire constructor, instead of
      just the first character.
      
      Test Plan: make test TEST=T14719
      
      Reviewers: alanz, bgamari, simonpj
      
      Reviewed By: alanz, simonpj
      
      Subscribers: simonpj, goldfire, rwbarton, thomie, carter
      
      GHC Trac Issues: #14719
      
      Differential Revision: https://phabricator.haskell.org/D4344
      
      (cherry picked from commit 59fa7b32)
      c60c6590
    • Tamar Christina's avatar
      Fix Windows stack allocations. · d4d6e448
      Tamar Christina authored
      On Windows we use the function `win32AllocStack` to do stack
      allocations in 4k blocks and insert a stack check afterwards
      to ensure the allocation returned a valid block.
      
      The problem is this function does something that by C semantics
      is pointless. The stack allocated value can never escape the
      function, and the stack isn't used so the compiler just optimizes
      away the entire function body.
      
      After considering a bunch of other possibilities I think the simplest
      fix is to just disable optimizations for the function.
      
      Alternatively inline assembly is an option but the stack check function
      doesn't have a very portable name as it relies on e.g. `libgcc`.
      
      Thanks to Sergey Vinokurov for helping diagnose and test.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, erikd, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14669
      
      Differential Revision: https://phabricator.haskell.org/D4343
      
      (cherry picked from commit a55d581f)
      d4d6e448
    • Herbert Valerio Riedel's avatar
      Add ptr-eq short-cut to `compareByteArrays#` primitive · 309d632c
      Herbert Valerio Riedel authored
      This is an obvious optimisation whose overhead is neglectable but
      which significantly simplifies the common uses of `compareByteArrays#`
      which would otherwise require to make *careful* use of
      `reallyUnsafePtrEquality#` or (equally fragile) `byteArrayContents#`
      which can result in less optimal assembler code being generated.
      
      Test Plan: carefully examined generated cmm/asm code; validate via phab
      
      Reviewers: alexbiehl, bgamari, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4319
      
      (cherry picked from commit 31c260f3)
      309d632c
  5. 23 Jan, 2018 2 commits
  6. 22 Jan, 2018 4 commits
    • Ryan Scott's avatar
      Fix #14692 by correcting an off-by-one error in TcGenDeriv · 1d05e0c7
      Ryan Scott authored
      A silly mistake in `gen_Show_binds` was causing derived
      `Show` instances for empty data types to case on the precedence
      argument instead of the actual value being showed.
      
      Test Plan: make test TEST=drv-empty-data
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14692
      
      Differential Revision: https://phabricator.haskell.org/D4328
      
      (cherry picked from commit 0074a08e)
      1d05e0c7
    • John Ky's avatar
      Add new mbmi and mbmi2 compiler flags · b75f8d26
      John Ky authored
      This adds support for the bit deposit and extraction operations provided
      by the BMI and BMI2 instruction set extensions on modern amd64 machines.
      
      Implement x86 code generator for pdep and pext.  Properly initialise
      bmiVersion field.
      
      pdep and pext test cases
      
      Fix pattern match for pdep and pext instructions
      
      Fix build of pdep and pext code for 32-bit architectures
      
      Test Plan: Validate
      
      Reviewers: austin, simonmar, bgamari, angerman
      
      Reviewed By: bgamari
      
      Subscribers: trommler, carter, angerman, thomie, rwbarton, newhoggy
      
      GHC Trac Issues: #14206
      
      Differential Revision: https://phabricator.haskell.org/D4236
      
      (cherry picked from commit f8557696)
      b75f8d26
    • Alp Mestanogullari's avatar
      tentative improvement to callstack docs · c1050953
      Alp Mestanogullari authored
      This is an attempt at clarifying the docs for HasCallStack in both the
      user guide and libraries/base/GHC/Stack/Types.hs. The example used right
      now is built around an hypothetical 'error' function that doesn't itself
      print call stacks, and the fact that this doesn't hold makes it all
      confusing, see #14635.
      
      Reviewers: hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14635
      
      Differential Revision: https://phabricator.haskell.org/D4317
      c1050953
    • Ben Gamari's avatar
      Bump terminfo submodule · 906983ca
      Ben Gamari authored
      906983ca
  7. 21 Jan, 2018 1 commit
    • Oleg Grenrus's avatar
      Update Cabal submodule · 61db0b89
      Oleg Grenrus authored
      - Cabal-2.2 uses SPDX license identifiers, so I had to update
        `cabal-version: 2.1` packages `license: BSD3` to
        `license: BSD-3-Clause`
      - `ghc-cabal` used old ReadP parsec, now it uses `parsec` too
      - InstalledPackageInfo pretty-printing have changed a little,
        fields with default values aren't printed. This can be changed in
        `Cabal` still, but I haven't found problems with omitting them.
      
      Note: `BSD-3-Clause` is parsed as "name = BSD, version = 3" by old
      parser (because 3-Clause looks like version 3 with tag Clause).
      If you see *"BSD-3" is not a valid license*, then something is using
      old parser still.
      
      Fixes #9885.
      
      (cherry picked from commit 5d6e0806c690ac1958e4cbf609bc6b18048fb761)
      61db0b89
  8. 18 Jan, 2018 5 commits
    • Ryan Scott's avatar
      Fix #14681 and #14682 with precision-aimed parentheses · 33e3b3eb
      Ryan Scott authored
      It turns out that `Convert` was recklessly leaving off
      parentheses in two places:
      
      * Negative numeric literals
      * Patterns in lambda position
      
      This patch fixes it by adding three new functions, `isCompoundHsLit`,
      `isCompoundHsOverLit`, and `isCompoundPat`, and using them in the
      right places in `Convert`. While I was in town, I also sprinkled
      `isCompoundPat` among some `Pat`-constructing functions in `HsUtils`
      to help avoid the likelihood of this problem happening in other
      places. One of these places is in `TcGenDeriv`, and sprinkling
      `isCompountPat` there fixes #14682
      
      Test Plan: make test TEST="T14681 T14682"
      
      Reviewers: alanz, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14681, #14682
      
      Differential Revision: https://phabricator.haskell.org/D4323
      
      (cherry picked from commit 575c009d)
      33e3b3eb
    • Andreas Klebinger's avatar
      Remove executable filename check on windows · 4eccca7e
      Andreas Klebinger authored
      On Windows GHC enforces currently that the real executable is named
      ghc.exe/ghc-stage[123].exe.
      
      I don't see a good reason why this is neccessary.
      This patch removes this restriction and fixes #14652
      
      Test Plan: ci
      
      Reviewers: bgamari, Phyx
      
      Reviewed By: Phyx
      
      Subscribers: Phyx, rwbarton, thomie, carter
      
      GHC Trac Issues: #14652
      
      Differential Revision: https://phabricator.haskell.org/D4296
      
      (cherry picked from commit 1bf70b20)
      4eccca7e
    • Tao He's avatar
      Fix hash in haddock of ghc-prim. · f28645c0
      Tao He authored
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14653
      
      Differential Revision: https://phabricator.haskell.org/D4305
      
      (cherry picked from commit 2feed118)
      f28645c0
    • Matthías Páll Gissurarson's avatar
      Inform hole substitutions of typeclass constraints (fixes #14273). · 96b52e63
      Matthías Páll Gissurarson authored
      This implements SPJ's suggestion on the ticket (#14273). We find the
      relevant constraints (ones that whose free unification variables are all
      mentioned in the type of the hole), and then clone the free unification
      variables of the hole and the relevant constraints. We then add a
      subsumption constraints and run the simplifier, and then check whether
      all the constraints were solved.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, rwbarton, thomie, carter
      
      GHC Trac Issues: #14273
      
      Differential Revision: https://phabricator.haskell.org/D4315
      
      (cherry picked from commit 1e14fd3e)
      96b52e63
    • Ryan Scott's avatar
      Improve treatment of sectioned holes · da83722c
      Ryan Scott authored
      Previously, GHC was pretty-printing left-section holes
      incorrectly and not parsing right-sectioned holes at all. This patch
      fixes both problems.
      
      Test Plan: make test TEST=T14590
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #14590
      
      Differential Revision: https://phabricator.haskell.org/D4273
      
      (cherry picked from commit 4d41e921)
      da83722c
  9. 17 Jan, 2018 1 commit
  10. 15 Jan, 2018 3 commits
    • John Ericson's avatar
      configure: Various cleanups · be8d6675
      John Ericson authored
      Substitute RanlibCmd for consistency, and other configure cleanups that
      should have no effect
      
      The other commands are so substituted. Maybe we don't need ranlib at
      all, and the configure snippet can be removed all together, but that
      can always be done later.
      
      Reviewers: bgamari, hvr, angerman
      
      Reviewed By: bgamari, angerman
      
      Subscribers: rwbarton, thomie, erikd, carter
      
      Differential Revision: https://phabricator.haskell.org/D4286
      
      (cherry picked from commit 8de89305)
      be8d6675
    • Ryan Scott's avatar
      Parenthesize forall-type args in cvtTypeKind · b92fb515
      Ryan Scott authored
      Trac #14646 happened because we forgot to parenthesize `forall` types to
      the left of an arrow. This simple patch fixes that.
      
      Test Plan: make test TEST=T14646
      
      Reviewers: alanz, goldfire, bgamari
      
      Reviewed By: alanz
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14646
      
      Differential Revision: https://phabricator.haskell.org/D4298
      
      (cherry picked from commit f380115c)
      b92fb515
    • Simon Peyton Jones's avatar
      Fix join-point decision · 20afdaa7
      Simon Peyton Jones authored
      This patch moves the "ok_unfolding" test
         from  CoreOpt.joinPointBinding_maybe
         to    OccurAnal.decideJoinPointHood
      
      Previously the occurrence analyser was deciding to make
      something a join point, but the simplifier was reversing
      that decision, which made the decision about /other/ bindings
      invalid.
      
      Fixes Trac #14650.
      
      (cherry picked from commit 66ff794f)
      20afdaa7
  11. 14 Jan, 2018 1 commit
    • Simon Peyton Jones's avatar
      Simplify HsPatSynDetails · 7c69f111
      Simon Peyton Jones authored
      This is a pure refactoring.  Use HsConDetails to implement
      HsPatSynDetails, instead of defining a whole new data type.
      Less code, fewer types, all good.
      
      (cherry picked from commit 584cbd4a)
      7c69f111