1. 10 Oct, 2016 9 commits
    • Ben Gamari's avatar
      Fix test output · f168a616
      Ben Gamari authored
      f168a616
    • Facundo Domínguez's avatar
      Don't ignore addTopDecls in module finalizers. · a77bbb8b
      Facundo Domínguez authored
      Summary:
      Module finalizer could call addTopDecls, however, the declarations
      added in this fashion were ignored. This patch makes sure to rename,
      type check and incorporate this declarations.
      
      Because a declaration may include a splice which calls addModFinalizer,
      the list of finalizers is repeteadly checked after adding declarations
      until no more finalizers remain.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, goldfire, simonpj, austin
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonmar, mboes, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2505
      
      GHC Trac Issues: #12559
      
      (cherry picked from commit 71dd6e44)
      a77bbb8b
    • Edward Z. Yang's avatar
      Remove reexports from ghc-boot, help bootstrap with GHC 8. · bdfb9012
      Edward Z. Yang authored
      (cherry picked from commit 940ded85)
      bdfb9012
    • Moritz Angermann's avatar
      Do not segfault if no common root can be found · ec055513
      Moritz Angermann authored
      When trying to profile a plugin, ghc mysteriously segfaulted.  Upon
      closer examination the segfault happend due to a `->prevStack` lookup
      on a NULL pointer.
      
      A new CostCentre: Unknown is introduced that is set, if ccsapp and
      ccsfn are of equal depth (e.g. 0), and do not have a common CostCentre
      in their stacks.
      
      Reviewers: bgamari, simonmar, austin, erikd
      
      Reviewed By: simonmar
      
      Subscribers: Phyx, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2551
      
      (cherry picked from commit bcd34451)
      ec055513
    • niteria's avatar
      Fix memory leak from #12664 · b08ffec0
      niteria authored
      This fixes the leak with `setProgArgv`. The problem was
      that `setProgArgv` would not free the objects pointed
      to by `prog_argc`, `prog_argv` when the globals were
      changed resulting in a leak.
      
      The only strictly necessary change is in `rts/RtsFlags.c`, but
      the code in `System.Environment` was a bit confusing and not
      exception safe, so I refactored it.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, ezyang, austin, hvr, bgamari, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2576
      
      GHC Trac Issues: #12664
      
      (cherry picked from commit e41b9c61)
      b08ffec0
    • Matthew Pickering's avatar
      Add missing test from D2545 · 7643c149
      Matthew Pickering authored
      This was somehow dropped from the original merge.
      
      Differential Revision: https://phabricator.haskell.org/D2545
      
      GHC Trac Issues: #12615
      
      (cherry picked from commit 1851349a)
      7643c149
    • Simon Peyton Jones's avatar
      More tests for Trac #12522 · 801cbb42
      Simon Peyton Jones authored
      These ones test the variations in coment:15 of the ticket
      
      (cherry picked from commit a6111b8c)
      801cbb42
    • Simon Peyton Jones's avatar
      Orient improvement constraints better · 12cfcbeb
      Simon Peyton Jones authored
      This patch fixes an infinite loop in the constraint solver,
      shown up by Trac #12522.
      
      The solution is /very/ simple: just reverse the orientation of the
      derived constraints arising from improvement using type-family
      injectivity.  I'm not very proud of the fix --- it seems fragile
      --- but it has the very great merit of simplicity, and it works
      fine.
      
      See Note [Improvement orientation] in TcInteract, and some
      discussion on the Trac ticket.
      
      (cherry picked from commit b255ae7b)
      12cfcbeb
    • Simon Peyton Jones's avatar
      Improve error handling in TcRnMonad · 5662ceae
      Simon Peyton Jones authored
      See Note [Constraints and errors] in TcRnMonad.  This
      patch fixes Trac #12124 in quite a neat way.
      
      (cherry picked from commit 465c6c5d)
      5662ceae
  2. 09 Oct, 2016 1 commit
  3. 02 Oct, 2016 17 commits
    • Ben Gamari's avatar
      runghc: Fix import of System.Process on Windows · 9cc5a8f4
      Ben Gamari authored
      This apparently should have been an import of rawSystem instead of
      runProcess. Oops.
      
      Fixes D2538.
      
      Test Plan: Validate on Linux and Windows.
      
      Reviewers: austin, snowleopard
      
      Reviewed By: snowleopard
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2561
      
      (cherry picked from commit 8952cc3e)
      9cc5a8f4
    • Michael Snoyman's avatar
      runghc: use executeFile to run ghc process on POSIX · c9042583
      Michael Snoyman authored
      This means that, on POSIX systems, there will be only one ghc process
      used for running scripts, as opposed to the current situation of a
      runghc process and a ghc process. Beyond minor performance benefits of
      not having an extra fork and resident process, the more important impact
      of this is automatically getting proper signal handling. I noticed this
      problem myself when running runghc as PID1 inside a Docker container.
      
      I attempted to create a shim library for executeFile that would work for
      both POSIX and Windows, but unfortunately I ran into issues with exit
      codes being propagated correctly (see
      https://github.com/fpco/replace-process/issues/2). Therefore, this patch
      leaves the Windows behavior unchanged. Given that signals are a POSIX
      issue, this isn't too bad a trade-off. If someone has suggestions for
      better Windows _exec support, please let me know.
      
      Reviewers: erikd, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: Phyx, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2538
      
      (cherry picked from commit 42f1d867)
      c9042583
    • Ben Gamari's avatar
      Fix expected output for T7786 · a24092ff
      Ben Gamari authored
      I believe this is a benign difference between master and ghc-8.0.
      a24092ff
    • Nicolas Trangez's avatar
      Turn `__GLASGOW_HASKELL_LLVM__` into an integer again · 3b13a042
      Nicolas Trangez authored
      In GHC < 8.0.1, the value of `__GLASGOW_HASKELL_LLVM__`, exposed
      through the preprocessor when compiled with `-fllvm`, was an integer
      value, encoded according to some rules specified in the user guide.
      
      Due to an oversight, in GHC 8.0.1 the value of this define became a
      tuple, exposed as e.g. `(3, 7)`. This was an unintended regression.
      
      This patch turns the value of the `__GLASGOW_HASKELL_LLVM__` definition
      into a single integer again, but changes the formatting of said number
      slightly. Before, any LLVM version where the major or minor component >=
      10 would cause ambiguous values for `__GLASGOW_HASKELL_LLVM__`. With
      this patch, the value is in line with `__GLASGOW_HASKELL__`, adding a
      padding `0` in-between major and minor component if applicable (we
      assume no minors >= 100 will ever exist).
      
      The documentation in the user guide is updated accordingly, and a
      reference is made in the 8.0.2 release notes.
      
      Test Plan: validate
      
      Reviewers: bgamari, erikd
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2552
      
      GHC Trac Issues: #12628
      
      (cherry picked from commit b0d53a83)
      3b13a042
    • Ben Gamari's avatar
      Fix T12593 · 4557d944
      Ben Gamari authored
      (cherry picked from commit 779bcc90cf8a52270bcd70a82442d01d35d7c788)
      4557d944
    • Ben Gamari's avatar
      Fix T12512 · 15df5170
      Ben Gamari authored
      15df5170
    • Simon Peyton Jones's avatar
      Fix a bug in occurs checking · 836f0e24
      Simon Peyton Jones authored
      1. Trac #12593 exposed a long-standing bug in the occurs
         checking machinery.  When unifying two type variables
                a ~ b
         where a /= b, we were assuming that there could be
         no occurs-check error.  But there can: 'a' can occur
         in b's kind!  When the RHS was a non-tyvar we used
         occurCheckExpand, which /did/ look in kinds, but not
         when the RHS was a tyvar.
      
         This bug has been lurking ever since TypeInType, maybe
         longer.  And it was present both in TcUnify (the on-the-fly
         unifier), and in TcInteract.
      
         I ended up refactoring both so that the tyvar/tyvar
         path naturally goes through the same occurs-check as
         non-tyvar rhss.  It's simpler and more robust now.
      
         One good thing is that both unifiers now share
             TcType.swapOverVars
             TcType.canSolveByUnification
         previously they had different logic for the same goals
      
      2. Fixing this bug exposed another!  In T11635 we end
         up unifying
         (alpha :: forall k. k->*) ~ (beta :: forall k. k->*)
         Now that the occurs check is done for tyvars too, we
         look inside beta's kind.  And then reject the program
         becuase of the forall inside there.  But in fact that
         forall is fine -- it does not count as impredicative
         polymoprhism.   See Note [Checking for foralls]
         in TcType.
      
      3. All this fuss around occurrence checking forced me
         to look at TcUnify.checkTauTvUpdate
                and TcType.occurCheckExpand
         There's a lot of duplication there, and I managed
         to elminate quite a bit of it. For example,
         checkTauTvUpdate called a local 'defer_me'; and then
         called occurCheckExpand, which then used a very
         similar 'fast_check'.
      
         Things are better, but there is more to do.
      
      (cherry picked from commit 66a8c194)
      836f0e24
    • Simon Peyton Jones's avatar
      Kill off redundant SigTv check in occurCheckExpand · 11f9bffb
      Simon Peyton Jones authored
      This patch simply deletes code, the SigTv check in
      occurCheckExpand.  As the new comment says
      
      In the past we also rejected a SigTv matched with a non-tyvar
      But it is wrong to reject that for Givens;
      and SigTv is in any case handled separately by
         - TcUnify.checkTauTvUpdate (on-the-fly unifier)
         - TcInteract.canSolveByUnification (main constraint solver)
      
      (cherry picked from commit d25cb61a)
      11f9bffb
    • Ryan Scott's avatar
      Disallow standalone deriving declarations involving unboxed tuples or sums · c448d551
      Ryan Scott authored
      There was an awful leak where GHC permitted standalone `deriving`
      declarations to create instances for unboxed sum or tuple types. This
      fortifies the checks that GHC performs to catch this scenario and give
      an appropriate error message.
      
      Fixes #11509.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2557
      
      GHC Trac Issues: #11509
      
      (cherry picked from commit 23cf32da)
      c448d551
    • Simon Peyton Jones's avatar
      Print foralls in user format · 906ea044
      Simon Peyton Jones authored
      This fixes Trac #12597: in RnNames.warnMissingSignatures,
      use pprSigmaType not pprType
      
      (cherry picked from commit 796f0f2a)
      906ea044
    • Ömer Sinan Ağacan's avatar
      Fix layout of MultiWayIf expressions (#10807) · cb03d1cc
      Ömer Sinan Ağacan authored
      With this patch we stop generating virtual semicolons in MultiWayIf
      guards. Fixes #10807.
      
      Test Plan:
      
      Reviewers: simonmar, austin, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2524
      
      GHC Trac Issues: #10807
      
      (cherry picked from commit c36904d6)
      cb03d1cc
    • Simon Peyton Jones's avatar
      Fix desugaring of pattern bindings (again) · d2695b84
      Simon Peyton Jones authored
      This patch fixes Trac #12595.  The problem was with a
      pattern binding like
           !x = e
      For a start it's silly to match that pattern and build
      a unit tuple (the General Case of mkSelectorBinds); but
      that's what was happening because the bang fell through
      to the general case.  But for a variable pattern building
      any auxiliary bindings is stupid.  So the patch
      introduces a new case in mkSelectorBinds for variable
      patterns.
      
      Then it turned out that if 'e' was a plain variable, and
      moreover was imported GlobalId, then matchSinglePat made
      it a /bound/ variable, which should never happen.  That
      ultimately caused a linker error, but the original bug
      was much earlier.
      
      (cherry picked from commit 2fbfbca2)
      d2695b84
    • Matthew Pickering's avatar
      Fix interaction of record pattern synonyms and record wildcards · 50e7157b
      Matthew Pickering authored
      We were missing an appropiate *ConLike lookup in the case when
      the pattern synonym was defined in a different module.
      
      Reviewers: austin, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2544
      
      GHC Trac Issues: #11987
      
      (cherry picked from commit 2d6642bd)
      50e7157b
    • Adam Gundry's avatar
      Do not warn about unused underscore-prefixed fields (fixes Trac #12609) · 63ce9ba2
      Adam Gundry authored
      When DuplicateRecordFields is enabled, the mangling of selector names
      was causing them to be reported as unused even if prefixed by an
      underscore. This corrects the OccName used by the check.
      
      Test Plan: New test overloadedrecflds/should_compile/T12609
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2549
      
      GHC Trac Issues: #12609
      
      (cherry picked from commit 48ff0843)
      63ce9ba2
    • Matthew Pickering's avatar
      Don't warn about name shadowing when renaming the patten in a PatSyn decl · 0c2b766d
      Matthew Pickering authored
      Previously the renamer assumed that *any* time we renamed a pattern, the
      pattern was introducing new binders. This isn't true in pattern synonym
      declarations where the pattern is used as part of a definition.
      
      We add a special case to not warn in this situation.
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2545
      
      GHC Trac Issues: #12615
      
      (cherry picked from commit 1851349a)
      0c2b766d
    • Peter Trommler's avatar
      PPC/CodeGen: fix lwa instruction generation · e7201e86
      Peter Trommler authored
      Opcode lwa is a 64-bit opcode and allows a DS-form only.  This patch
      generates lwa opcodes only when the offset is a multiple of 4.
      
      Fixes #12621
      
      Test Plan: validate
      
      Reviewers: erikd, hvr, simonmar, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2547
      
      GHC Trac Issues: #12621
      
      (cherry picked from commit ce3370e0)
      e7201e86
    • Sylvain HENRY's avatar
      CodeGen X86: fix unsafe foreign calls wrt inlining · aec4a514
      Sylvain HENRY authored
      Foreign calls (unsafe and safe) interact badly with inlining and
      register passing ABIs (see #11792 and #12614):
      the inlined code to compute a parameter of the call may overwrite a
      register already set to pass a preceding parameter.
      
      With this patch, we compute all parameters which are not simple
      expressions before assigning them to fixed registers required by the
      ABI.
      
      Test Plan:
         - Add test (test both reg and stack parameters)
         - Validate
      
      Reviewers: osa1, bgamari, austin, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2263
      
      GHC Trac Issues: #11792, #12614
      
      (cherry picked from commit b61b7c24)
      aec4a514
  4. 27 Sep, 2016 1 commit
  5. 19 Sep, 2016 4 commits
    • Sergei Trofimovich's avatar
      configure.ac: fix --host= handling · b2050299
      Sergei Trofimovich authored
      The following command fails as:
          $ ./configure --prefix=/usr \
              --build=x86_64-pc-linux-gnu \
              --host=x86_64-pc-linux-gnu \
              --target=x86_64-pc-linux-gnu
          configure: error:
          You've selected:
      
            BUILD:  x86_64-unknown-linux
            HOST:   x86_64-unknown-linux
            TARGET: x86_64-unknown-linux
      
          BUILD must equal HOST;
      
      18f06878
      
       changed native
      configure $build/$host/$target checks to ghc-mangled ones,
      but not completely.
      Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
      
      Reviewers: rwbarton, erikd, austin, hvr, bgamari, Phyx
      
      Reviewed By: Phyx
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2508
      
      GHC Trac Issues: #12487
      
      (cherry picked from commit 0cc3931b)
      b2050299
    • Tamar Christina's avatar
      Fix configure detection. · 682518d4
      Tamar Christina authored
      Summary:
      GHC's configure script seems to normalize the values returned from config.guess.
      So for Windows it turns x86_64-pc-mingw64 into x86_64-unknown-mingw32.
      These mangled names are stored in the values $BuildPlatform, $HostPlatform
      and $TargetPlatform.
      
      However further down the file when the comparison is done between the stage0
      compiler and the host the normalized versions are not used.
      So when normalization actually changes the triple this check will fail.
      
      Not sure why it's worked for all this time.. Nor if this is the right fix?
      Does it still work for cross compiling correctly?
      
      Test Plan: ./configure
      
      Reviewers: hvr, austin, thomie, bgamari, erikd
      
      Reviewed By: erikd
      
      Subscribers: erikd, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2452
      
      GHC Trac Issues: #12487
      
      (cherry picked from commit 18f06878)
      682518d4
    • Gabor Greif's avatar
      Trim all spaces after 'version:' · ec6526ea
      Gabor Greif authored
      ... that we grep out of libraries/Cabal/Cabal/Cabal.cabal
      
      This is necessary because the file got reformatted
      in the 'master' branch.
      
      (cherry picked from commit 1101045c)
      ec6526ea
    • Simon Peyton Jones's avatar
      Fix scoping of type variables in instances · e134a5bc
      Simon Peyton Jones authored
      This fixes Trac #12531:
      
         class Foo x where
           foo :: forall a . x a -> x a
           default foo :: forall b . x b -> x b
           foo x = go
             where go :: x b
                   go = undefined
      
      We want 'b' to scope over the code for 'foo', but we were
      using 'a' instead.
      
      (cherry picked from commit 0050aff2)
      e134a5bc
  6. 18 Sep, 2016 5 commits
  7. 16 Sep, 2016 1 commit
    • Ben Gamari's avatar
      Fix T12504 · 21c20203
      Ben Gamari authored
      This had an extra_files directive, which does not exist in ghc-8.0, from
      cherry-picking.
      21c20203
  8. 15 Sep, 2016 2 commits
    • Simon Peyton Jones's avatar
      Improve typechecking of instance defaults · 54b887b5
      Simon Peyton Jones authored
      In an instance declaration when you don't specify the code for a
      method, GHC fills in from the default binding in the class.
      The type of the default method can legitmiately be ambiguous ---
      see Note [Default methods in instances] in TcInstDcls --- so
      typechecking it can be tricky.
      
      Trac #12220 showed that although we were dealing with that ambiguity
      for /vanilla/ default methods, we were not doing so for /generic/
      default methods.  Moreover we were dealing with it clumsily, by
      generating post-typechecked code.
      
      This patch fixes the bug AND deletes code!  We now use the same code
      path for both vanilla and generic default methods; and generate
      /pre-typechecked/ code in both cases.  The key trick is that we can use
      Visible Type Application to deal with the ambiguity, which wasn't
      possible before.  Hooray.
      
      There is a small hit to performance in compiler/perf/T1969 which
      consists of nothing BUT instance declarations with several default
      methods to fill, which we now have to typecheck. The actual hit is
      from 724 -> 756 or 4% in that extreme example.  Real world programs
      have vastly fewer instance decls.
      
      (cherry picked from commit d2958bd0)
      54b887b5
    • Simon Marlow's avatar
      Fix codegen bug in PIC version of genSwitch (#12433) · a0472f8d
      Simon Marlow authored
      Summary:
      * getNonClobberedReg instead of getSomeReg, because the reg needs to
        survive across t_code
      * Use a new reg for the table offset calculation instead of clobbering
        the reg returned by expr (this was the bug affecting #12433)
      
      Test Plan: New unit test; validate
      
      Reviewers: rwbarton, bgamari, austin, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2529
      
      GHC Trac Issues: #12433
      a0472f8d