Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save idontgetoutmuch/017ce5277e5d08adcebe167c566e5c00 to your computer and use it in GitHub Desktop.

Select an option

Save idontgetoutmuch/017ce5277e5d08adcebe167c566e5c00 to your computer and use it in GitHub Desktop.
GHC Panic
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.1.20170131 for x86_64-apple-darwin):
applyTypeToArgs
Expression: sizeofArray# @ e ds2_ibOz i#_ibWB
Type: forall a. Array# a -> Int#
Args: [TYPE: e, ds2_ibOz, i#_ibWB]
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1166:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1170:37 in ghc:Outputable
pprPanic, called at compiler/coreSyn/CoreUtils.hs:223:14 in ghc:CoreUtils
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
@idontgetoutmuch

idontgetoutmuch commented Feb 1, 2017

Copy link
Copy Markdown
Author
Unstaged changes (8)
modified   compiler/cmm/CmmMachOp.hs
@@ -528,6 +528,7 @@ data CallishMachOp
   | MO_F64_Atan
   | MO_F64_Log
   | MO_F64_Exp
+  | MO_F64_Fabs
   | MO_F64_Sqrt
   | MO_F32_Pwr
   | MO_F32_Sin
@@ -541,6 +542,7 @@ data CallishMachOp
   | MO_F32_Atan
   | MO_F32_Log
   | MO_F32_Exp
+  | MO_F32_Fabs
   | MO_F32_Sqrt
 
   | MO_UF_Conv Width
modified   compiler/cmm/PprC.hs
@@ -754,6 +754,7 @@ pprCallishMachOp_for_C mop
         MO_F64_Log      -> text "log"
         MO_F64_Exp      -> text "exp"
         MO_F64_Sqrt     -> text "sqrt"
+        MO_F64_Fabs     -> text "fabs"
         MO_F32_Pwr      -> text "powf"
         MO_F32_Sin      -> text "sinf"
         MO_F32_Cos      -> text "cosf"
@@ -767,6 +768,7 @@ pprCallishMachOp_for_C mop
         MO_F32_Log      -> text "logf"
         MO_F32_Exp      -> text "expf"
         MO_F32_Sqrt     -> text "sqrtf"
+        MO_F32_Fabs     -> text "fabsf"
         MO_WriteBarrier -> text "write_barrier"
         MO_Memcpy _     -> text "memcpy"
         MO_Memset _     -> text "memset"
modified   compiler/codeGen/StgCmmPrim.hs
@@ -1251,6 +1251,7 @@ callishOp DoubleAtanOp   = Just MO_F64_Atan
 callishOp DoubleLogOp    = Just MO_F64_Log
 callishOp DoubleExpOp    = Just MO_F64_Exp
 callishOp DoubleSqrtOp   = Just MO_F64_Sqrt
+callishOp DoubleFabsOp   = Just MO_F64_Fabs
 
 callishOp FloatPowerOp  = Just MO_F32_Pwr
 callishOp FloatSinOp    = Just MO_F32_Sin
@@ -1265,6 +1266,7 @@ callishOp FloatAtanOp   = Just MO_F32_Atan
 callishOp FloatLogOp    = Just MO_F32_Log
 callishOp FloatExpOp    = Just MO_F32_Exp
 callishOp FloatSqrtOp   = Just MO_F32_Sqrt
+callishOp FloatFabsOp   = Just MO_F32_Fabs
 
 callishOp _ = Nothing
 
modified   compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -690,6 +690,7 @@ cmmPrimOpFunctions mop = do
     MO_F32_Exp    -> fsLit "expf"
     MO_F32_Log    -> fsLit "logf"
     MO_F32_Sqrt   -> fsLit "llvm.sqrt.f32"
+    MO_F32_Fabs   -> fsLit "llvm.fabs.f32"
     MO_F32_Pwr    -> fsLit "llvm.pow.f32"
 
     MO_F32_Sin    -> fsLit "llvm.sin.f32"
@@ -707,6 +708,7 @@ cmmPrimOpFunctions mop = do
     MO_F64_Exp    -> fsLit "exp"
     MO_F64_Log    -> fsLit "log"
     MO_F64_Sqrt   -> fsLit "llvm.sqrt.f64"
+    MO_F64_Fabs   -> fsLit "llvm.fabs.f64"
     MO_F64_Pwr    -> fsLit "llvm.pow.f64"
 
     MO_F64_Sin    -> fsLit "llvm.sin.f64"
modified   compiler/nativeGen/PPC/CodeGen.hs
@@ -1525,6 +1525,7 @@ genCCall' dflags gcp target dest_regs args
                     MO_F32_Exp   -> (fsLit "exp", True)
                     MO_F32_Log   -> (fsLit "log", True)
                     MO_F32_Sqrt  -> (fsLit "sqrt", True)
+                    MO_F32_Fabs  -> (fsLit "fabs", True)
 
                     MO_F32_Sin   -> (fsLit "sin", True)
                     MO_F32_Cos   -> (fsLit "cos", True)
@@ -1542,6 +1543,7 @@ genCCall' dflags gcp target dest_regs args
                     MO_F64_Exp   -> (fsLit "exp", False)
                     MO_F64_Log   -> (fsLit "log", False)
                     MO_F64_Sqrt  -> (fsLit "sqrt", False)
+                    MO_F64_Fabs  -> (fsLit "fabs", False)
 
                     MO_F64_Sin   -> (fsLit "sin", False)
                     MO_F64_Cos   -> (fsLit "cos", False)
modified   compiler/nativeGen/SPARC/CodeGen.hs
@@ -610,6 +610,7 @@ outOfLineMachOp_table mop
         MO_F32_Exp    -> fsLit "expf"
         MO_F32_Log    -> fsLit "logf"
         MO_F32_Sqrt   -> fsLit "sqrtf"
+        MO_F32_Fabs   -> fsLit "fabsf"
         MO_F32_Pwr    -> fsLit "powf"
 
         MO_F32_Sin    -> fsLit "sinf"
@@ -627,6 +628,7 @@ outOfLineMachOp_table mop
         MO_F64_Exp    -> fsLit "exp"
         MO_F64_Log    -> fsLit "log"
         MO_F64_Sqrt   -> fsLit "sqrt"
+        MO_F64_Fabs   -> fsLit "fabs"
         MO_F64_Pwr    -> fsLit "pow"
 
         MO_F64_Sin    -> fsLit "sin"
modified   compiler/nativeGen/X86/CodeGen.hs
@@ -2573,6 +2573,7 @@ outOfLineCmmOp mop res args
 
         fn = case mop of
               MO_F32_Sqrt  -> fsLit "sqrtf"
+              MO_F32_Fabs  -> fsLit "fabsf"
               MO_F32_Sin   -> fsLit "sinf"
               MO_F32_Cos   -> fsLit "cosf"
               MO_F32_Tan   -> fsLit "tanf"
@@ -2589,6 +2590,7 @@ outOfLineCmmOp mop res args
               MO_F32_Pwr   -> fsLit "powf"
 
               MO_F64_Sqrt  -> fsLit "sqrt"
+              MO_F64_Fabs  -> fsLit "fabs"
               MO_F64_Sin   -> fsLit "sin"
               MO_F64_Cos   -> fsLit "cos"
               MO_F64_Tan   -> fsLit "tan"
modified   compiler/prelude/primops.txt.pp
@@ -554,6 +554,11 @@ primop   DoubleSqrtOp   "sqrtDouble#"      Monadic
    with
    code_size = { primOpCodeSizeForeignCall }
 
+primop   DoubleFabsOp   "fabsDouble#"      Monadic
+   Double# -> Double#
+   with
+   code_size = { primOpCodeSizeForeignCall }
+
 primop   DoubleSinOp   "sinDouble#"      Monadic
    Double# -> Double#
    with
@@ -678,6 +683,11 @@ primop   FloatSqrtOp   "sqrtFloat#"      Monadic
    with
    code_size = { primOpCodeSizeForeignCall }
 
+primop   FloatFabsOp   "fabsFloat#"      Monadic
+   Float# -> Float#
+   with
+   code_size = { primOpCodeSizeForeignCall }
+
 primop   FloatSinOp   "sinFloat#"      Monadic
    Float# -> Float#
    with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment