Opened 2 years ago

Closed 19 months ago

#7534 closed bug (duplicate)

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 Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

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 (12)

comment:1 Changed 2 years 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.

comment:2 Changed 2 years ago by PHO

  • Cc pho@… added

comment:3 Changed 2 years ago by simonpj

  • difficulty set to Unknown
  • Owner set to simonmar

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

Simon

comment:4 Changed 2 years 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.

comment:5 Changed 2 years 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.

comment:6 Changed 2 years ago by PHO

Isn't this related to #7442?

comment:7 follow-up: Changed 2 years ago by simonmar

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

comment:8 in reply to: ↑ 7 Changed 2 years 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.

comment:9 Changed 2 years 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.

comment:10 Changed 2 years 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.

comment:11 Changed 2 years ago by igloo

  • Milestone set to 7.8.1
  • Priority changed from normal to high

comment:12 Changed 19 months ago by thoughtpolice

  • Resolution set to duplicate
  • Status changed from new to closed

This looks like an exact duplicate of #7574, and I've been working on it the past day, so I'll close this.

Note: See TracTickets for help on using tickets.