Opened 3 years ago

Closed 5 months ago

#11764 closed bug (fixed)

ghc internal error building llvm-general-3.5.1.2

Reported by: andrew.wja Owned by:
Priority: high Milestone: 8.6.1
Component: Compiler Version: 7.10.3
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case: cabal install llvm-general
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by bgamari)

$ cabal install llvm-general
Resolving dependencies...
Configuring llvm-general-3.5.1.2...
Building llvm-general-3.5.1.2...
Failed to install llvm-general-3.5.1.2
Build log ( /home/andrew/.cabal/logs/llvm-general-3.5.1.2.log ):
[1 of 1] Compiling Main             ( /tmp/cabal-tmp-12630/llvm-general-3.5.1.2/dist/setup/setup.hs, /tmp/cabal-tmp-12630/llvm-general-3.5.1.2/dist/setup/Main.o )
Linking /tmp/cabal-tmp-12630/llvm-general-3.5.1.2/dist/setup/setup ...
Configuring llvm-general-3.5.1.2...
Building llvm-general-3.5.1.2...
Preprocessing library llvm-general-3.5.1.2...
[ 1 of 93] Compiling LLVM.General.Internal.FFI.ByteRangeCallback ( src/LLVM/General/Internal/FFI/ByteRangeCallback.hs, dist/build/LLVM/General/Internal/FFI/ByteRangeCallback.o )
[ 2 of 93] Compiling LLVM.General.Internal.FFI.Transforms ( src/LLVM/General/Internal/FFI/Transforms.hs, dist/build/LLVM/General/Internal/FFI/Transforms.o )
[ 3 of 93] Compiling LLVM.General.Internal.Inject ( src/LLVM/General/Internal/Inject.hs, dist/build/LLVM/General/Internal/Inject.o )
[ 4 of 93] Compiling LLVM.General.Internal.FFI.Context ( src/LLVM/General/Internal/FFI/Context.hs, dist/build/LLVM/General/Internal/FFI/Context.o )
[ 5 of 93] Compiling LLVM.General.Internal.FFI.CommandLine ( src/LLVM/General/Internal/FFI/CommandLine.hs, dist/build/LLVM/General/Internal/FFI/CommandLine.o )
[ 6 of 93] Compiling LLVM.General.Internal.FFI.Iterate ( src/LLVM/General/Internal/FFI/Iterate.hs, dist/build/LLVM/General/Internal/FFI/Iterate.o )
[ 7 of 93] Compiling LLVM.General.Internal.FFI.PtrHierarchy ( src/LLVM/General/Internal/FFI/PtrHierarchy.hs, dist/build/LLVM/General/Internal/FFI/PtrHierarchy.o )
[ 8 of 93] Compiling LLVM.General.Internal.FFI.BasicBlock ( src/LLVM/General/Internal/FFI/BasicBlock.hs, dist/build/LLVM/General/Internal/FFI/BasicBlock.o )
[ 9 of 93] Compiling LLVM.General.Internal.FFI.User ( src/LLVM/General/Internal/FFI/User.hs, dist/build/LLVM/General/Internal/FFI/User.o )
[10 of 93] Compiling LLVM.General.Internal.FFI.GlobalAlias ( src/LLVM/General/Internal/FFI/GlobalAlias.hs, dist/build/LLVM/General/Internal/FFI/GlobalAlias.o )
[11 of 93] Compiling LLVM.General.Internal.FFI.LLVMCTypes ( dist/build/LLVM/General/Internal/FFI/LLVMCTypes.hs, dist/build/LLVM/General/Internal/FFI/LLVMCTypes.o )
[12 of 93] Compiling LLVM.General.Internal.FFI.Attribute ( src/LLVM/General/Internal/FFI/Attribute.hs, dist/build/LLVM/General/Internal/FFI/Attribute.o )
[13 of 93] Compiling LLVM.General.Internal.FFI.GlobalValue ( src/LLVM/General/Internal/FFI/GlobalValue.hs, dist/build/LLVM/General/Internal/FFI/GlobalValue.o )
[14 of 93] Compiling LLVM.General.Internal.FFI.Instruction ( src/LLVM/General/Internal/FFI/Instruction.hs, dist/build/LLVM/General/Internal/FFI/Instruction.o )
[15 of 93] Compiling LLVM.General.Internal.FFI.Type ( src/LLVM/General/Internal/FFI/Type.hs, dist/build/LLVM/General/Internal/FFI/Type.o )
[16 of 93] Compiling LLVM.General.Internal.FFI.Value ( src/LLVM/General/Internal/FFI/Value.hs, dist/build/LLVM/General/Internal/FFI/Value.o )
[17 of 93] Compiling LLVM.General.Internal.FFI.BinaryOperator ( src/LLVM/General/Internal/FFI/BinaryOperator.hs, dist/build/LLVM/General/Internal/FFI/BinaryOperator.o )
[18 of 93] Compiling LLVM.General.Internal.FFI.DataLayout ( src/LLVM/General/Internal/FFI/DataLayout.hs, dist/build/LLVM/General/Internal/FFI/DataLayout.o )
[19 of 93] Compiling LLVM.General.Internal.FFI.SMDiagnostic ( src/LLVM/General/Internal/FFI/SMDiagnostic.hs, dist/build/LLVM/General/Internal/FFI/SMDiagnostic.o )
[20 of 93] Compiling LLVM.General.Internal.FFI.Module ( src/LLVM/General/Internal/FFI/Module.hs, dist/build/LLVM/General/Internal/FFI/Module.o )
[21 of 93] Compiling LLVM.General.Internal.FFI.ExecutionEngine ( src/LLVM/General/Internal/FFI/ExecutionEngine.hs, dist/build/LLVM/General/Internal/FFI/ExecutionEngine.o )
[22 of 93] Compiling LLVM.General.Internal.FFI.Function ( src/LLVM/General/Internal/FFI/Function.hs, dist/build/LLVM/General/Internal/FFI/Function.o )
[23 of 93] Compiling LLVM.General.Internal.FFI.InlineAssembly ( src/LLVM/General/Internal/FFI/InlineAssembly.hs, dist/build/LLVM/General/Internal/FFI/InlineAssembly.o )
[24 of 93] Compiling LLVM.General.Internal.FFI.InstructionDefs ( dist/build/LLVM/General/Internal/FFI/InstructionDefs.hs, dist/build/LLVM/General/Internal/FFI/InstructionDefs.o )
[25 of 93] Compiling LLVM.General.Internal.InstructionDefs ( src/LLVM/General/Internal/InstructionDefs.hs, dist/build/LLVM/General/Internal/InstructionDefs.o )
[26 of 93] Compiling LLVM.General.Internal.FFI.MemoryBuffer ( src/LLVM/General/Internal/FFI/MemoryBuffer.hs, dist/build/LLVM/General/Internal/FFI/MemoryBuffer.o )
[27 of 93] Compiling LLVM.General.Internal.FFI.Metadata ( src/LLVM/General/Internal/FFI/Metadata.hs, dist/build/LLVM/General/Internal/FFI/Metadata.o )
[28 of 93] Compiling LLVM.General.Internal.FFI.GlobalVariable ( src/LLVM/General/Internal/FFI/GlobalVariable.hs, dist/build/LLVM/General/Internal/FFI/GlobalVariable.o )
[29 of 93] Compiling LLVM.General.Internal.FFI.RawOStream ( src/LLVM/General/Internal/FFI/RawOStream.hs, dist/build/LLVM/General/Internal/FFI/RawOStream.o )
[30 of 93] Compiling LLVM.General.Internal.FFI.Assembly ( src/LLVM/General/Internal/FFI/Assembly.hs, dist/build/LLVM/General/Internal/FFI/Assembly.o )
[31 of 93] Compiling LLVM.General.Internal.FFI.Bitcode ( src/LLVM/General/Internal/FFI/Bitcode.hs, dist/build/LLVM/General/Internal/FFI/Bitcode.o )
[32 of 93] Compiling LLVM.General.Internal.FFI.Target ( src/LLVM/General/Internal/FFI/Target.hs, dist/build/LLVM/General/Internal/FFI/Target.o )
[33 of 93] Compiling LLVM.General.Internal.FFI.Threading ( src/LLVM/General/Internal/FFI/Threading.hs, dist/build/LLVM/General/Internal/FFI/Threading.o )
[34 of 93] Compiling LLVM.General.Internal.FFI.Cleanup ( src/LLVM/General/Internal/FFI/Cleanup.hs, dist/build/LLVM/General/Internal/FFI/Cleanup.o )
[35 of 93] Compiling LLVM.General.Internal.FFI.Constant ( src/LLVM/General/Internal/FFI/Constant.hs, dist/build/LLVM/General/Internal/FFI/Constant.o )
ghc: internal error: stg_ap_pv_ret
    (GHC version 7.10.3 for x86_64_unknown_linux)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
cabal: Error: some packages failed to install:
llvm-general-3.5.1.2 failed during the building phase. The exception was:
ExitFailure (-6)

Change History (9)

comment:1 Changed 8 months ago by George

Fails to compile on 8.4.2 before it gets to that file so llvm-general needs to be updated before we know if this problem still exists on 8.4.2

cabal install -j5 llvm-general
...
Failed to install llvm-general-pure-3.5.0.0
Build log ( /Users/gcolpitts/.cabal/logs/ghc-8.4.2/llvm-general-pure-3.5.0.0-K5dZ1oCl0eTJBIlvbqyDx8.log ):
cabal: Entering directory '/var/folders/9b/rh4y2gy92hgdb6ktv4df1jv00000gn/T/cabal-tmp-72872/llvm-general-pure-3.5.0.0'
Configuring llvm-general-pure-3.5.0.0...
Warning: The package has an extraneous version range for a dependency on an
internal library: llvm-general-pure ==3.5.0.0. This version range includes the
current package but isn't needed as the current package's library will always
be used.
...
Preprocessing library for llvm-general-pure-3.5.0.0..
Building library for llvm-general-pure-3.5.0.0..
...
[27 of 28] Compiling LLVM.General.Internal.PrettyPrint ( src/LLVM/General/Internal/PrettyPrint.hs, dist/build/LLVM/General/Internal/PrettyPrint.o )

src/LLVM/General/Internal/PrettyPrint.hs:61:10: error:
    • No instance for (Semigroup QTree)
        arising from the superclasses of an instance declaration
    • In the instance declaration for ‘Monoid QTree’
   |
61 | instance Monoid QTree where
...

filed issue at https://github.com/bscarlet/llvm-general/issues/209
Last edited 6 months ago by George (previous) (diff)

comment:2 Changed 8 months ago by bgamari

Description: modified (diff)

comment:3 Changed 8 months ago by bgamari

Milestone: 8.6.1
Priority: normalhigh

comment:4 Changed 6 months ago by bgamari

Owner: set to dfeuer

comment:5 Changed 6 months ago by George

Status: newinfoneeded

comment:6 Changed 5 months ago by bgamari

Owner: dfeuer deleted

comment:7 Changed 5 months ago by George

Doesn't compile on 8.4.3 either, looks ot be same errors as on 8.4.2 (see above)

comment:8 Changed 5 months ago by RyanGlScott

So I checked out llvm-general from https://github.com/bscarlet/llvm-general (commit 26dac5d35d304f43ffd20fadcbb5175a81ec3f24, which corresponds to llvm-general-3.5.1.2) and applied the following patch to allow it to build on GHC 8.4.3:

  • llvm-general-pure/src/LLVM/General/Internal/PrettyPrint.hs

    diff --git a/llvm-general-pure/src/LLVM/General/Internal/PrettyPrint.hs b/llvm-general-pure/src/LLVM/General/Internal/PrettyPrint.hs
    index 5dae66e..13a79d9 100644
    a b  
    11{-# LANGUAGE
     2  CPP,
    23  TemplateHaskell,
    34  QuasiQuotes,
    45  ViewPatterns,
    module LLVM.General.Internal.PrettyPrint where 
    89
    910import LLVM.General.Prelude
    1011
    11 import LLVM.General.TH 
     12import LLVM.General.TH
    1213import Language.Haskell.TH.Quote
    1314
    1415import Data.Monoid
    defaultPrettyShowEnv = PrettyShowEnv { 
    4243    precedence = 0
    4344  }
    4445
    45 type Qual a = Reader PrettyShowEnv a 
     46type Qual a = Reader PrettyShowEnv a
    4647
    4748prec :: Int -> Qual a -> Qual a
    4849prec p = local (\env -> env { precedence = p })
    indentGroup = fmap (return . IndentGroup) 
    5859instance IsString QTree where
    5960  fromString = return . return . Fixed
    6061
     62instance Semigroup QTree where
     63  (<>) = mappend
     64
    6165instance Monoid QTree where
    6266  mempty = return mempty
    6367  mappend a b = mappend <$> a <*> b
    renderEx threshold indent env ts = 
    7175      where
    7276        bit (Fixed s) = (length s, s, s)
    7377        bit (Variable t f) = (length f, f, concat [ s:(if s == '\n' then ind i else "") | s <- t ])
    74         bit (IndentGroup tree) = 
     78        bit (IndentGroup tree) =
    7579          let (l, t, f) = fit (i+1) tree
    7680          in (l, t, if (l < threshold) then t else "\n" ++ ind (i+1) ++ f ++ "\n" ++ ind i)
    7781        (ls, ts, fs) = unzip3 . map bit $ branches
    78            
     82
    7983render = renderEx 80 "  " defaultPrettyShowEnv
    8084
    8185comma = "," <> variable "\n" " "
    simpleName n = do 
    161165makePrettyShowInstance :: Name -> DecsQ
    162166makePrettyShowInstance n = do
    163167  info <- reify n
    164   let (tvb, cons) = 
     168  let (tvb, cons) =
    165169        case info of
     170#if __GLASGOW_HASKELL__ >= 800
     171          TyConI (DataD _ _ tvb _ cons _) -> (tvb, cons)
     172          TyConI (NewtypeD _ _ tvb _ con _) -> (tvb, [con])
     173#else
    166174          TyConI (DataD _ _ tvb cons _) -> (tvb, cons)
    167175          TyConI (NewtypeD _ _ tvb con _) -> (tvb, [con])
     176#endif
    168177          x -> error $ "unexpected info: " ++ show x
    169178  cs <- mapM (const $ newName "a") tvb
    170179  let cvs = map varT cs
    makePrettyShowInstance n = do 
    177186               RecC conName (unzip3 -> (ns, _, _)) -> do
    178187                 pvs <- mapM (const $ newName "f") ns
    179188                 let ss = [| record $(simpleName conName) $(listE [[|($(simpleName n), prettyShow $(varE pv))|] | (n, pv) <- zip ns pvs]) |]
    180                  match 
     189                 match
    181190                   (conP conName (map varP pvs))
    182191                   (normalB ss)
    183192                   []
    184193               NormalC conName fs -> do
    185194                 pvs <- mapM (const $ newName "f") fs
    186195                 let ss = [| ctor $(simpleName conName) $(listE [[| prettyShow $(varE pv)|] | pv <- pvs]) |]
    187                  match 
     196                 match
    188197                   (conP conName (map varP pvs))
    189198                   (normalB ss)
    190199                   []
    191200               InfixC (_, n0) conName (_, n1) -> do
     201#if __GLASGOW_HASKELL__ >= 800
     202                 justFixity <- reifyFixity conName
     203                 let Fixity prec _ = fromMaybe defaultFixity justFixity
     204#else
    192205                 DataConI _ _ _ (Fixity prec _) <- reify conName
     206#endif
    193207                 let ns = [n0, n1]
    194208                 [p0,p1] <- mapM (const $ newName "f") ns
    195209                 let ss = [| parensIfNeeded prec (prettyShow $(varE p0) <+> $(simpleName conName) <+> prettyShow $(varE p1)) |]
    makePrettyShowInstance n = do 
    203217     ]
    204218   ]
    205219
    206  
     220
    207221
  • llvm-general-pure/src/LLVM/General/PrettyPrint.hs

    diff --git a/llvm-general-pure/src/LLVM/General/PrettyPrint.hs b/llvm-general-pure/src/LLVM/General/PrettyPrint.hs
    index 9f26fff..f8b5148 100644
    a b module LLVM.General.PrettyPrint ( 
    1111  shortPrefixScheme,
    1212  longPrefixScheme,
    1313  defaultPrefixScheme,
    14   basePrefixScheme, 
     14  basePrefixScheme,
    1515  shortASTPrefixScheme,
    1616  longASTPrefixScheme,
    1717  imports
    import qualified LLVM.General.AST.Float as A 
    3232import qualified LLVM.General.AST.FloatingPointPredicate as A
    3333import qualified LLVM.General.AST.IntegerPredicate as A
    3434import qualified LLVM.General.AST.FunctionAttribute as A
    35 import qualified LLVM.General.AST.ParameterAttribute as A 
     35import qualified LLVM.General.AST.ParameterAttribute as A
    3636import qualified LLVM.General.AST.CallingConvention as A
    3737import qualified LLVM.General.AST.Visibility as A
    3838import qualified LLVM.General.AST.DLL as A.DLL
    showPrettyEx width indent (PrefixScheme ps) = renderEx width indent (defaultPret 
    107107-- | A 'PrefixScheme' is a mapping between haskell module names and
    108108-- the prefixes with which they should be rendered when printing code.
    109109newtype PrefixScheme = PrefixScheme (Map String (Maybe String))
    110   deriving (Eq, Ord, Read, Show, Monoid)
     110  deriving (Eq, Ord, Read, Show, Monoid, Semigroup)
    111111
    112112-- | a 'PrefixScheme' for types not of llvm-general, but nevertheless used
    113113-- in the AST. Useful for building other 'PrefixScheme's.
  • llvm-general/Setup.hs

    diff --git a/llvm-general/Setup.hs b/llvm-general/Setup.hs
    index 4a833ae..d9cb25d 100644
    a b import Distribution.Version 
    1717import System.Environment
    1818import System.SetEnv
    1919import Distribution.System
     20import Distribution.Types.CondTree
    2021
    2122-- define these selectively in C files (where _not_ using HsFFI.h),
    2223-- rather than universally in the ccOptions, because HsFFI.h currently defines them
    2324-- without checking they're already defined and so causes warnings.
    2425uncheckedHsFFIDefines = ["__STDC_LIMIT_MACROS"]
    2526
    26 llvmVersion = Version [3,5] []
     27llvmVersion = mkVersion [3,5]
    2728
    2829llvmConfigNames = [
    29   "llvm-config-" ++ (intercalate "." . map show . versionBranch $ llvmVersion),
     30  "llvm-config-" ++ (intercalate "." . map show . versionNumbers $ llvmVersion),
    3031  "llvm-config"
    3132 ]
    3233
    instance OldHookable (Args -> PackageDescription -> LocalBuildInfo -> UserHooks 
    6768llvmProgram :: Program
    6869llvmProgram = (simpleProgram "llvm-config") {
    6970  programFindLocation = programSearch (programFindLocation . simpleProgram),
    70   programFindVersion = 
     71  programFindVersion =
    7172    let
    7273      stripSuffix suf str = let r = reverse in liftM r (stripPrefix (r suf) (r str))
    7374      svnToTag v = maybe v (++"-svn") (stripSuffix "svn" v)
    addLLVMToLdLibraryPath configFlags = do 
    9899  llvmConfig <- getLLVMConfig configFlags
    99100  [libDir] <- liftM lines $ llvmConfig "--libdir"
    100101  addToLdLibraryPath libDir
    101                            
     102
    102103main = do
    103104  let origUserHooks = simpleUserHooks
    104                  
     105
    105106  defaultMainWithHooks origUserHooks {
    106107    hookedPrograms = [ llvmProgram ],
    107108
    main = do 
    128129                    libBuildInfo = mempty { ccOptions = llvmCppFlags }
    129130                  },
    130131                condTreeComponents = condTreeComponents libraryCondTree ++ [
    131                   (
    132                     Var (Flag (FlagName "shared-llvm")),
    133                     CondNode (mempty { libBuildInfo = mempty { extraLibs = [sharedLib] ++ systemLibs } }) [] [],
    134                     Just (CondNode (mempty { libBuildInfo = mempty { extraLibs = staticLibs ++ systemLibs } }) [] [])
    135                   )
    136                 ] 
     132                  CondBranch {
     133                    condBranchCondition = Var (Flag (mkFlagName "shared-llvm")),
     134                    condBranchIfTrue    = CondNode (mempty { libBuildInfo = mempty { extraLibs = [sharedLib] ++ systemLibs } }) [] [],
     135                    condBranchIfFalse   = Just (CondNode (mempty { libBuildInfo = mempty { extraLibs = staticLibs ++ systemLibs } }) [] [])
     136                  }
     137                ]
    137138              }
    138139           }
    139140          configFlags' = configFlags {
  • llvm-general/llvm-general.cabal

    diff --git a/llvm-general/llvm-general.cabal b/llvm-general/llvm-general.cabal
    index 05d7554..251c333 100644
    a b flag debug 
    5353  description: compile C(++) shims with debug info for ease of troubleshooting
    5454  default: False
    5555
     56custom-setup
     57  setup-depends: base, Cabal, containers, setenv
     58
    5659library
    5760  build-tools: llvm-config
    5861  ghc-options: -fwarn-unused-imports
  • llvm-general/src/Control/Monad/Exceptable.hs

    diff --git a/llvm-general/src/Control/Monad/Exceptable.hs b/llvm-general/src/Control/Monad/Exceptable.hs
    index 258797d..b12f2df 100644
    a b instance (Read e, Read1 m, Read a) => Read (ExceptableT e m a) where 
    150150instance (Show e, Show1 m, Show a) => Show (ExceptableT e m a) where
    151151    showsPrec d (ExceptableT m) = showsUnary1 "ExceptableT" d m
    152152
     153{-
    153154instance (Read e, Read1 m) => Read1 (ExceptableT e m) where readsPrec1 = readsPrec
    154155instance (Show e, Show1 m) => Show1 (ExceptableT e m) where showsPrec1 = showsPrec
     156-}
    155157
    156158runExceptableT :: ExceptableT e m a -> m (Either e a)
    157159runExceptableT =  Except.runExceptT . unExceptableT
  • llvm-general/src/LLVM/General/Internal/FFI/PassManager.hs

    diff --git a/llvm-general/src/LLVM/General/Internal/FFI/PassManager.hs b/llvm-general/src/LLVM/General/Internal/FFI/PassManager.hs
    index 3aaaad5..df4da78 100644
    a b $(do 
    7575                            | h == ''FilePath -> [t| NothingAsEmptyString CString |]
    7676                  _ -> typeMapping t
    7777              _ -> typeMapping t
    78         foreignDecl 
     78        foreignDecl
    7979          (cName n)
    8080          ("add" ++ n ++ "Pass")
    81           ([[t| Ptr PassManager |]] 
     81          ([[t| Ptr PassManager |]]
    8282           ++ [[t| Ptr TargetMachine |] | needsTargetMachine n]
    8383           ++ map passTypeMapping extraParams)
    8484          (TH.tupleT 0)
    8585
    86   TH.TyConI (TH.DataD _ _ _ cons _) <- TH.reify ''G.Pass
     86  TH.TyConI (TH.DataD _ _ _ _ cons _) <- TH.reify ''G.Pass
    8787  liftM concat $ forM cons $ \con -> case con of
    8888    TH.RecC n l -> declareForeign n [ t | (_,_,t) <- l ]
    8989    TH.NormalC n [] -> declareForeign n []
    $(do 
    9393data PassManagerBuilder
    9494
    9595foreign import ccall unsafe "LLVMPassManagerBuilderCreate" passManagerBuilderCreate ::
    96     IO (Ptr PassManagerBuilder) 
     96    IO (Ptr PassManagerBuilder)
    9797
    9898foreign import ccall unsafe "LLVMPassManagerBuilderDispose" passManagerBuilderDispose ::
    9999    Ptr PassManagerBuilder -> IO ()
    100100
    101101foreign import ccall unsafe "LLVMPassManagerBuilderSetOptLevel" passManagerBuilderSetOptLevel ::
    102     Ptr PassManagerBuilder -> CUInt -> IO () 
     102    Ptr PassManagerBuilder -> CUInt -> IO ()
    103103
    104104foreign import ccall unsafe "LLVMPassManagerBuilderSetSizeLevel" passManagerBuilderSetSizeLevel ::
    105105    Ptr PassManagerBuilder -> CUInt -> IO ()
    106106
    107107foreign import ccall unsafe "LLVMPassManagerBuilderSetDisableUnitAtATime" passManagerBuilderSetDisableUnitAtATime ::
    108     Ptr PassManagerBuilder -> LLVMBool -> IO () 
     108    Ptr PassManagerBuilder -> LLVMBool -> IO ()
    109109
    110110foreign import ccall unsafe "LLVMPassManagerBuilderSetDisableUnrollLoops" passManagerBuilderSetDisableUnrollLoops ::
    111111    Ptr PassManagerBuilder -> CUInt -> IO ()
    112112
    113113foreign import ccall unsafe "LLVMPassManagerBuilderSetDisableSimplifyLibCalls" passManagerBuilderSetDisableSimplifyLibCalls ::
    114     Ptr PassManagerBuilder -> LLVMBool -> IO () 
     114    Ptr PassManagerBuilder -> LLVMBool -> IO ()
    115115
    116116foreign import ccall unsafe "LLVMPassManagerBuilderUseInlinerWithThreshold" passManagerBuilderUseInlinerWithThreshold ::
    117117    Ptr PassManagerBuilder -> CUInt -> IO ()
    118118
    119119foreign import ccall unsafe "LLVMPassManagerBuilderPopulateFunctionPassManager" passManagerBuilderPopulateFunctionPassManager ::
    120     Ptr PassManagerBuilder -> Ptr PassManager -> IO () 
     120    Ptr PassManagerBuilder -> Ptr PassManager -> IO ()
    121121
    122122foreign import ccall unsafe "LLVMPassManagerBuilderPopulateModulePassManager" passManagerBuilderPopulateModulePassManager ::
    123123    Ptr PassManagerBuilder -> Ptr PassManager -> IO ()
    124124
    125125foreign import ccall unsafe "LLVMPassManagerBuilderPopulateLTOPassManager" passManagerBuilderPopulateLTOPassManager ::
    126     Ptr PassManagerBuilder -> Ptr PassManager -> CUChar -> CUChar -> IO () 
     126    Ptr PassManagerBuilder -> Ptr PassManager -> CUChar -> CUChar -> IO ()
    127127
    128128foreign import ccall unsafe "LLVM_General_PassManagerBuilderSetLibraryInfo" passManagerBuilderSetLibraryInfo ::
    129129    Ptr PassManagerBuilder -> Ptr TargetLibraryInfo -> IO ()
  • llvm-general/src/LLVM/General/Internal/InstructionDefs.hs

    diff --git a/llvm-general/src/LLVM/General/Internal/InstructionDefs.hs b/llvm-general/src/LLVM/General/Internal/InstructionDefs.hs
    index bf19a90..253fcb7 100644
    a b import qualified LLVM.General.AST.Constant as A.C 
    2727
    2828$(do
    2929   let ctorRecs t = do
    30          TH.TyConI (TH.DataD _ _ _ cons _) <- TH.reify t
     30         TH.TyConI (TH.DataD _ _ _ _ cons _) <- TH.reify t
    3131         TH.dataToExpQ (const Nothing) $ [ (TH.nameBase n, rec) | rec@(TH.RecC n _) <- cons ]
    3232
    33    [d| 
     33   [d|
    3434      astInstructionRecs = Map.fromList $(ctorRecs ''A.Instruction)
    3535      astConstantRecs = Map.fromList $(ctorRecs ''A.C.Constant)
    3636    |]
    outerJoin xs ys = Map.unionWith combine 
    5353      combine (Just a, Nothing) (Nothing, Just b) = (Just a, Just b)
    5454      combine _ _ = error "outerJoin: the impossible happened"
    5555
    56 instrP = TH.QuasiQuoter { 
     56instrP = TH.QuasiQuoter {
    5757  TH.quoteExp = undefined,
    5858  TH.quotePat = let m = Map.fromList [ (ID.cAPIName i, ID.cppOpcode i) | i <- ID.instructionDefs ]
    5959             in TH.dataToPatQ (const Nothing) . (m Map.!),
  • llvm-general/src/LLVM/General/Internal/PassManager.hs

    diff --git a/llvm-general/src/LLVM/General/Internal/PassManager.hs b/llvm-general/src/LLVM/General/Internal/PassManager.hs
    index fec64f9..ecd3c15 100644
    a b instance (Monad m, MonadAnyCont IO m) => EncodeM m GCOVVersion CString where 
    8888createPassManager :: PassSetSpec -> IO (Ptr FFI.PassManager)
    8989createPassManager pss = flip runAnyContT return $ do
    9090  pm <- liftIO $ FFI.createPassManager
    91   forM_ (dataLayout pss) $ \dl -> liftIO $ withFFIDataLayout dl $ FFI.addDataLayoutPass pm 
     91  forM_ (dataLayout pss) $ \dl -> liftIO $ withFFIDataLayout dl $ FFI.addDataLayoutPass pm
    9292  forM_ (targetLibraryInfo pss) $ \(TargetLibraryInfo tli) -> do
    9393    liftIO $ FFI.addTargetLibraryInfoPass pm tli
    9494  forM_ (targetMachine pss) $ \(TargetMachine tm) -> liftIO $ FFI.addAnalysisPasses tm pm
    9595  case pss of
    9696    s@CuratedPassSetSpec {} -> liftIO $ do
    9797      bracket FFI.passManagerBuilderCreate FFI.passManagerBuilderDispose $ \b -> do
    98         let handleOption g m = forM_ (m s) (g b <=< encodeM) 
     98        let handleOption g m = forM_ (m s) (g b <=< encodeM)
    9999        handleOption FFI.passManagerBuilderSetOptLevel optLevel
    100100        handleOption FFI.passManagerBuilderSetSizeLevel sizeLevel
    101101        handleOption FFI.passManagerBuilderSetDisableUnitAtATime (liftM not . unitAtATime)
    createPassManager pss = flip runAnyContT return $ do 
    108108      let tm = maybe nullPtr (\(TargetMachine tm) -> tm) tm'
    109109      forM_ ps $ \p -> $(
    110110        do
    111           TH.TyConI (TH.DataD _ _ _ cons _) <- TH.reify ''Pass
     111          TH.TyConI (TH.DataD _ _ _ _ cons _) <- TH.reify ''Pass
    112112          TH.caseE [| p |] $ flip map cons $ \con -> do
    113113            let
    114114              (n, fns) = case con of
    115115                            TH.RecC n fs -> (n, [ TH.nameBase fn | (fn, _, _) <- fs ])
    116116                            TH.NormalC n [] -> (n, [])
    117               actions = 
     117              actions =
    118118                [ TH.bindS (TH.varP . TH.mkName $ fn) [| encodeM $(TH.dyn fn) |] | fn <- fns ]
    119119                ++ [
    120120                 TH.noBindS [|

After doing this, I was able to cabal new-build the entirety of llvm-general without experiencing any sort of panic.

In light of this, I'm inclined to close this issue. Does everyone agree?

comment:9 Changed 5 months ago by RyanGlScott

Resolution: fixed
Status: infoneededclosed

Closing due to inability to reproduce the issue on newer GHCs.

Note: See TracTickets for help on using tickets.