[commit: ghc] ghc-7.10: compiler: make sure we reject -O + HscInterpreted (20d33af)

git at git.haskell.org git at git.haskell.org
Tue Jun 2 19:24:37 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/20d33af1ff4375a735845081be41fbd8a1472d28/ghc

>---------------------------------------------------------------

commit 20d33af1ff4375a735845081be41fbd8a1472d28
Author: Austin Seipp <austin at well-typed.com>
Date:   Tue May 19 01:56:48 2015 -0500

    compiler: make sure we reject -O + HscInterpreted
    
    When using GHCi, we explicitly reject optimization, because the
    compilers optimization passes can introduce unboxed tuples, which the
    interpreter is not able to handle. But this goes the other way too: using
    GHCi on optimized code may cause the optimizer to float out breakpoints
    that the interpreter introduces. This manifests itself in weird ways,
    particularly if you as an API client use custom DynFlags to introduce
    optimization in combination with HscInterpreted.
    
    It turns out we weren't checking for consistent DynFlag settings when
    doing `setSessionDynFlags`, as #10052 showed. While the main driver
    handled it in `DynFlags` via `parseDynamicFlags`, we didn't check this
    elsewhere.
    
    This does a little refactoring to split out some of the common code, and
    immunizes the various `DynFlags` utilities in the `GHC` module from this
    particular bug. We should probably be checking other general invariants
    too.
    
    This fixes #10052, and adds some notes about the behavior in `GHC` and
    `FloatOut`
    
    As a bonus, expose `warningMsg` from `ErrUtils` as a helper since it
    didn't exist (somehow).
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>
    
    Reviewed By: edsko
    
    Differential Revision: https://phabricator.haskell.org/D727
    
    GHC Trac Issues: #10052
    
    (cherry picked from commit 091944e3aec736b440a9c1204f152004e382c967)


>---------------------------------------------------------------

20d33af1ff4375a735845081be41fbd8a1472d28
 compiler/main/DynFlags.hs                          | 12 ++++---
 compiler/main/ErrUtils.hs                          |  6 +++-
 compiler/main/GHC.hs                               | 41 ++++++++++++++++++----
 compiler/simplCore/FloatOut.hs                     | 27 ++++++++++++++
 testsuite/.gitignore                               |  1 +
 testsuite/tests/ghc-api/T10052/Makefile            | 12 +++++++
 testsuite/tests/ghc-api/T10052/T10052-input.hs     |  1 +
 testsuite/tests/ghc-api/T10052/T10052.hs           | 30 ++++++++++++++++
 .../T10052/T10052.stderr}                          |  0
 testsuite/tests/ghc-api/T10052/T10052.stdout       |  1 +
 testsuite/tests/ghc-api/T10052/all.T               |  2 ++
 .../tests/ghci.debugger/scripts/print007.stderr    |  5 ++-
 12 files changed, 125 insertions(+), 13 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 20d33af1ff4375a735845081be41fbd8a1472d28


More information about the ghc-commits mailing list