[GHC] #4803: "can't find a register in class ‘BREG’ while reloading ‘asm’" - problem with dynamic link libraries

GHC cvs-ghc at haskell.org
Mon Nov 29 19:09:11 CET 2010


#4803: "can't find a register in class ‘BREG’ while reloading ‘asm’" - problem
with dynamic link libraries
-----------------------+----------------------------------------------------
    Reporter:  guest   |       Owner:                           
        Type:  bug     |      Status:  new                      
    Priority:  normal  |   Component:  Compiler                 
     Version:  6.12.3  |    Keywords:                           
    Testcase:          |   Blockedby:                           
          Os:  Linux   |    Blocking:                           
Architecture:  x86     |     Failure:  GHC rejects valid program
-----------------------+----------------------------------------------------
 When compiling the cpuid package with dynamic link libraries I get the
 following error:
 {{{
 $ cabal install --enable-shared cpuid-0.2
 ...
 cbits/cpuid.c: In function ‘cpuid’:

 cbits/cpuid.c:7:0:
      error: can't find a register in class ‘BREG’ while reloading ‘asm’

 cbits/cpuid.c:7:0:  error: ‘asm’ operand has impossible constraints
 ...
 }}}

 The shortest call of ghc to reproduce this error is:
 {{{
 cpuid-0.2/cbits$ ghc -fPIC -c cpuid.c
 }}}

 The shortest call of gcc to reproduce this error is:
 {{{
 cpuid-0.2/cbits$ gcc -fPIC -c cpuid.c
 }}}

 The content of cpuid.c is:
 {{{
 void cpuid(int in, int * aa, int * bb, int * cc, int * dd)
 {
   int a, b, c, d;
   asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
   *aa = a;
   *bb = b;
   *cc = c;
   *dd = d;
 }
 }}}

 Shall I consider this a bug of GHC or of the cpuid package?
 Since GCC complains about this problem, I'm afraid it must be solved in
 the cpuid package.
 Just wanted to make sure the problem is reported somewhere.

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


More information about the Glasgow-haskell-bugs mailing list