#9303 closed bug (fixed)

O2: (GHC version 7.8.3 for x86_64-unknown-linux): allocateRegsAndSpill: Cannot read from uninitialized register %vI_s1Mp

Reported by: slyfox Owned by: simonmar
Priority: highest Milestone: 7.8.4
Component: Compiler (NCG) Version: 7.8.3
Keywords: Cc: simonmar
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

ghc --make -O2 M.hs 
[1 of 1] Compiling M                ( M.hs, M.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.3 for x86_64-unknown-linux):
        allocateRegsAndSpill: Cannot read from uninitialized register
    %vI_s1Mp

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

As in #9155 bug was caught on wx package in the same module. I didn't try to trim it down to minimal sample.

No external modules required.

Attachments (2)

M.hs (1.6 KB) - added by slyfox 14 months ago.
M-mini.hs (765 bytes) - added by slyfox 14 months ago.
slightly smaller example

Download all attachments as: .zip

Change History (9)

Changed 14 months ago by slyfox

Changed 14 months ago by slyfox

slightly smaller example

comment:1 Changed 14 months ago by slyfox

The same for -HEAD:

  (GHC version 7.9.20140710 for x86_64-unknown-linux):
        allocateRegsAndSpill: Cannot read from uninitialized register
    %vI_s12v

comment:2 Changed 14 months ago by simonpj

  • Owner set to simonmar

This looks like #9155 again, but Simon M fixed it, and the fix was merged.

Simon M will look again.

comment:3 Changed 14 months ago by simonmar

  • Milestone set to 7.8.4
  • Priority changed from normal to highest

comment:4 Changed 14 months ago by slyfox

Managed to squeeze M-mini into even shorter example:

-- a.hs
module M (f) where

f :: Int -> Int
f i = go [ 1, 0 ]
    where
      go :: [Int] -> Int
      go []     = undefined
      go [1]    = undefined
      go (x:xs) | x == i    = 2
                | otherwise = go xs

profiled -HEAD can even show stack trace:

[sf] /tmp:~/dev/git/ghc/inplace/bin/ghc-stage2 --make -O2 a.hs
[1 of 1] Compiling M                ( a.hs, a.o )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 7.9.20140712 for x86_64-unknown-linux):
        allocateRegsAndSpill: Cannot read from uninitialized register
    %vI_sNc
Stack trace:
  AsmCodeGen.RegAlloc (compiler/nativeGen/AsmCodeGen.lhs:(521,27)-(523,55))
  AsmCodeGen.cmmNativeGen (compiler/nativeGen/AsmCodeGen.lhs:379:47-95)
  CodeOutput.NativeCodeGen (compiler/main/CodeOutput.lhs:153:18-69)
  CodeOutput.OutputAsm (compiler/main/CodeOutput.lhs:(151,37)-(153,69))
  HscMain.codeOutput (compiler/main/HscMain.hs:(1180,16)-(1181,50))
  GhcMake.upsweep_mod.compile_it (compiler/main/GhcMake.hs:(1186,13)-(1188,66))
  GhcMake.upsweep_mod (compiler/main/GhcMake.hs:(1135,1)-(1280,49))
  GhcMake.upsweep.upsweep' (compiler/main/GhcMake.hs:(1068,3)-(1124,64))
  GhcMake.upsweep (compiler/main/GhcMake.hs:(1063,1)-(1124,64))
  GhcMake.load (compiler/main/GhcMake.hs:(150,1)-(369,38))
  GHC.defaultCleanupHandler (compiler/main/GHC.hs:(384,1)-(390,11))
  GHC.runGhc (compiler/main/GHC.hs:(414,1)-(419,7))

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

comment:5 Changed 13 months ago by Simon Marlow <marlowsd@…>

In da70f9ef49a545707dc32db9662441b9c8845fba/ghc:

Allow multiple entry points when allocating recursive groups (#9303)

Summary:
In this example we ended up with some code that was only reachable via
an info table, because a branch had been optimised away by the native
code generator.  The register allocator then got confused because it
was only considering the first block of the proc to be an entry point,
when actually any of the info tables are entry points.

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: simonmar, relrod, carter

Differential Revision: https://phabricator.haskell.org/D88

comment:6 Changed 13 months ago by simonmar

  • Status changed from new to merge

comment:7 Changed 13 months ago by thoughtpolice

  • Resolution set to fixed
  • Status changed from merge to closed

Merged.

Note: See TracTickets for help on using tickets.