[GHC] #7574: Register allocator chokes on certain branches with literals

GHC cvs-ghc at haskell.org
Fri Apr 12 15:50:19 CEST 2013


#7574: Register allocator chokes on certain branches with literals
---------------------------------+------------------------------------------
    Reporter:  thoughtpolice     |       Owner:                    
        Type:  bug               |      Status:  new               
    Priority:  normal            |   Milestone:                    
   Component:  Compiler (NCG)    |     Version:  7.7               
    Keywords:  ncg, codegen      |          Os:  Unknown/Multiple  
Architecture:  Unknown/Multiple  |     Failure:  Compile-time crash
  Difficulty:  Unknown           |    Testcase:                    
   Blockedby:  7573              |    Blocking:                    
     Related:  #7571,#7534       |  
---------------------------------+------------------------------------------

Old description:

> While running the test for #7571 (test is in #7573,) under
> '''WAY=normal''' instead of '''WAY=llvm''', I encountered this bug in the
> native backend:
>
> {{{
>
> =====> T7571(normal) 6 of 6 [0, 0, 0]
> cd . && '/Users/a/code/haskell/ghc/inplace/bin/ghc-stage2' -fforce-recomp
> -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts
> -fno-ghci-history -c T7571.cmm   -no-hs-main   >T7571.comp.stderr 2>&1
> Compile failed (status 256) errors were:
> ghc-stage2: panic! (the 'impossible' happened)
>   (GHC version 7.7.20130113 for x86_64-apple-darwin):
>         allocateRegsAndSpill: Cannot read from uninitialized register
>     %vI_c7
>
> }}}
>
> The test in question is:
>
> {{{
>
> #include "Cmm.h"
>
> testLiteralBranch (W_ dst, W_ src)
> {
>   if (1) {
>     prim %memcpy(dst, src, 1024, 4);
>   } else {
>     prim %memcpy(dst, src, 512, 8);
>   }
>   return ();
> }
>
> }}}
>
> If you comment out the branch conditionals, the test passes, so clearly
> something fishy is going on here. The test also fails if you change the
> condition to ```if (1 == 1)```
>
> I have absolutely no idea how this did not trip the profiling-based build
> in StgStdThunks.cmm, like in the LLVM build c.f. #7571

New description:

 {{{

 }}}
 While running the test for #7571 (test is in #7573,) under
 '''WAY=normal''' instead of '''WAY=llvm''', I encountered this bug in the
 native backend:

 {{{

 =====> T7571(normal) 6 of 6 [0, 0, 0]
 cd . && '/Users/a/code/haskell/ghc/inplace/bin/ghc-stage2' -fforce-recomp
 -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts
 -fno-ghci-history -c T7571.cmm   -no-hs-main   >T7571.comp.stderr 2>&1
 Compile failed (status 256) errors were:
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 7.7.20130113 for x86_64-apple-darwin):
         allocateRegsAndSpill: Cannot read from uninitialized register
     %vI_c7

 }}}

 The test in question is:

 {{{

 #include "Cmm.h"

 testLiteralBranch (W_ dst, W_ src)
 {
   if (1) {
     prim %memcpy(dst, src, 1024, 4);
   } else {
     prim %memcpy(dst, src, 512, 8);
   }
   return ();
 }

 }}}

 If you comment out the branch conditionals, the test passes, so clearly
 something fishy is going on here. The test also fails if you change the
 condition to ```if (1 == 1)```

 I have absolutely no idea how this did not trip the profiling-based build
 in StgStdThunks.cmm, like in the LLVM build c.f. #7571

--

Comment(by simonpj):

 So this ticket is looking more important than it was before!

 Would anyone like to look at it?

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7574#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list