Opened 2 months ago

Closed 13 days ago

#16094 closed bug (fixed)

panic! (the 'impossible' happened): for powerpc-unknown-linux getRegister(ppc): I64[I32[BaseReg + 812] + 64]

Reported by: slyfox Owned by: trommler
Priority: normal Milestone:
Component: Compiler Version: 8.6.3
Keywords: Cc: trommler, hvr
Operating System: Linux Architecture: powerpc
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): https://gitlab.haskell.org/ghc/ghc/merge_requests/42
Wiki Page:

Description

On current HEAD ghc fails build on powerpc32:

$ ./configure --target=powerpc-unknown-linux-gnu
$ make
...
"inplace/bin/ghc-stage1" -static  -H32m -O -Wall   -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint      -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen            -O2 -Wcpp-undef    -Wnoncanonical-monad-instances  -c rts/HeapStackCheck.cmm -o rts/dist/build/HeapStackCheck.o
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 8.7.20181223 for powerpc-unknown-linux):
        getRegister(ppc)
  I64[I32[BaseReg + 812] + 64]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
        pprPanic, called at compiler/nativeGen/PPC/CodeGen.hs:693:24 in ghc:PPC.CodeGen
$ inplace/bin/ghc-stage1 --info
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts"," -fwrapv -fno-builtin")
 ,("C compiler command","powerpc-unknown-linux-gnu-gcc")
 ,("C compiler flags"," -fno-stack-protector")
 ,("C compiler link flags"," -fuse-ld=gold")
 ,("C compiler supports -no-pie","YES")
 ,("Haskell CPP command","powerpc-unknown-linux-gnu-gcc")
 ,("Haskell CPP flags","-E -undef -traditional")
 ,("ld command","powerpc-unknown-linux-gnu-ld.gold")
 ,("ld flags","")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","YES")
 ,("ld supports filelist","NO")
 ,("ld is GNU ld","YES")
 ,("ar command","powerpc-unknown-linux-gnu-ar")
 ,("ar flags","q")
 ,("ar supports at file","YES")
 ,("ranlib command","powerpc-unknown-linux-gnu-ranlib")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("libtool command","libtool")
 ,("perl command","/usr/bin/perl")
 ,("cross compiling","YES")
 ,("target os","OSLinux")
 ,("target arch","ArchPPC")
 ,("target word size","4")
 ,("target has GNU nonexec stack","True")
 ,("target has .ident directive","True")
 ,("target has subsections via symbols","False")
 ,("target has RTS linker","YES")
 ,("Unregisterised","NO")
 ,("LLVM llc command","llc")
 ,("LLVM opt command","opt")
 ,("LLVM clang command","clang")
 ,("Project version","8.7.20181223")
 ,("Project Git commit id","bd8a6bde2ee73e599800137b9428a401bc105985")
 ,("Booter version","8.4.4")
 ,("Stage","1")
 ,("Build platform","x86_64-unknown-linux")
 ,("Host platform","x86_64-unknown-linux")
 ,("Target platform","powerpc-unknown-linux")
 ,("Have interpreter","YES")
 ,("Object splitting supported","YES")
 ,("Have native code generator","YES")
 ,("Support SMP","YES")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn thr_debug_p debug_p")
 ,("RTS expects libdw","NO")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Support Backpack","YES")
 ,("Requires unified installed package IDs","YES")
 ,("Uses package keys","YES")
 ,("Uses unit IDs","YES")
 ,("Dynamic by default","NO")
 ,("GHC Dynamic","NO")
 ,("GHC Profiled","NO")
 ,("Leading underscore","NO")
 ,("Debug on","False")
 ,("LibDir","/home/slyfox/dev/git/ghc-ppc/inplace/lib")
 ,("Global Package DB","/home/slyfox/dev/git/ghc-ppc/inplace/lib/package.conf.d")
 ]

Change History (12)

comment:1 Changed 2 months ago by slyfox

Cc: trommler added

I think it happens in stg_gc_noregs function on StgTSO_alloc_limit(CurrentTSO) lt (0::I64) expression.

CCing Peter in case it's an obvious omission in CMM or NCG.

comment:2 Changed 2 months ago by trommler

Architecture: Unknown/Multiplepowerpc
Operating System: Unknown/MultipleLinux
Owner: set to trommler
Type of failure: None/UnknownBuilding GHC failed

I think the panic is caused by a lack of 64-bit comparison operations on 32-bit PowerPC.

The change in stg_gc_noregs is in changeset:d70b19bfb5ed79b22c2ac31e22f46782fc47a117. This commit has an implementation for X86 but not for PowerPC.

I can provide a patch but I will need help with testing. There is no support for PowerPC 32-bit in openSUSE anymore :-(

comment:3 Changed 2 months ago by trommler

Cc: hvr added

I am copying @hvr for the AIX port, which is also 32-bit.

comment:4 Changed 2 months ago by trommler

Differential Rev(s): https://gitlab.haskell.org/ghc/ghc/merge_requests/42
Status: newpatch

The patch in merge request 42 has passed validate on powerpc64le Linux.

comment:5 Changed 8 weeks ago by trommler

Status: patchmerge

Fixed in changeset:ef57272e28f5047599249ae457609a079d8aebef.

Could this be merged to the 8.6 branch as well?

comment:6 Changed 6 weeks ago by bgamari

Is this really needed on ghc-8.6? ef57272e28f5047599249ae457609a079d8aebef doesn't apply cleanly as-is.

comment:7 Changed 6 weeks ago by trommler

I will prepare a patch based on the 8.6 branch and push it to gitlab. If you decide to not merge the patch after all it is at least there for packagers to include in their packages.

comment:8 Changed 5 weeks ago by bgamari

Did this ever happen, Peter?

comment:9 in reply to:  8 Changed 5 weeks ago by trommler

Replying to bgamari:

Did this ever happen, Peter?

I got sidetracked with the port to FreeBSD. I will work on it tomorrow morning (European time).

comment:10 Changed 5 weeks ago by trommler

Merge request 130: https://gitlab.haskell.org/ghc/ghc/merge_requests/130

As with the fix for HEAD I tested on powerpc64le but not on 32-bit PowerPC.

Sorry for the delay!

comment:11 Changed 13 days ago by bgamari

Last edited 13 days ago by bgamari (previous) (diff)

comment:12 Changed 13 days ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.