Ticket #7534 (new bug)

Opened 5 months ago

Last modified 6 weeks ago

allocateRegsAndSpill: Cannot read from uninitialized register

Reported by: erikd Owned by:
Priority: high Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc: pho@…
Operating System: Linux Architecture: powerpc64
Type of failure: Building GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Building git HEAD on linux-powerpc64 and I get:

ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 7.7.20121227 for powerpc-unknown-linux):
        allocateRegsAndSpill: Cannot read from uninitialized register
    %vI_na5b

Change History

  Changed 5 months ago by erikd

From compiler/nativeGen/RegAlloc/Linear/Main.hs:

    -- NOTE: if the input to the NCG contains some
    -- unreachable blocks with junk code, this panic
    -- might be triggered.  Make sure you only feed
    -- sensible code into the NCG.  In CmmPipeline we
    -- call removeUnreachableBlocks at the end for this
    -- reason.

  Changed 5 months ago by PHO

  • cc pho@… added

  Changed 5 months ago by simonpj

  • owner set to simonmar
  • difficulty set to Unknown

Simon M, could this be anything to do with the new codegen path? I'll asssign it to you for now.

Simon

  Changed 4 months ago by simonmar

So the background is that this panic used to be commented out, but I enabled it recently because it makes debugging much easier (with the panic commented out, the compiler will happily generate completely bogus code that will crash at runtime). However, it adds another invariant, as mentioned in the comment: all register must be written before they are read (not an unreasonable assumption, I'm sure you'll agree) I presume this invariant is being violated somewhere.

To debug it you'll need to use -ddump-cmm and find out where the bogus code comes from.

  Changed 4 months ago by simonmar

  • status changed from new to infoneeded

More info needed to make progress on this one, the repro case only happens on PPC/Linux.

  Changed 4 months ago by PHO

Isn't this related to #7442?

follow-up: ↓ 8   Changed 4 months ago by simonmar

I don't immediately see the connection to #7442?

in reply to: ↑ 7   Changed 4 months ago by PHO

Replying to simonmar:

I don't immediately see the connection to #7442?

Just a thought. Even though PPC/Linux doesn't have the problem described in the note [inconsistent-pic-reg], PIC.initialisePicBase_ppc still semms to be assuming only the first block is an entry point.

  Changed 4 months ago by erikd

  • status changed from infoneeded to new

I added -ddump-cmm to the command line of the compile that was failing and saved the output to a file. Unfortunately there is no sign on the uninitialized register %vI_na5b in the dumped file.

  Changed 4 months ago by simonmar

  • owner simonmar deleted

This could be the same as #7574, I described the fix that was needed on that ticket and @thoughtpolice said he would look into it.

  Changed 6 weeks ago by igloo

  • priority changed from normal to high
  • milestone set to 7.8.1
Note: See TracTickets for help on using tickets.