[GHC] #7083: Reduce the likelihood of x64/x86-64 changes breaking the build on other arches

GHC cvs-ghc at haskell.org
Fri Jul 20 03:55:34 CEST 2012


#7083: Reduce the likelihood of x64/x86-64 changes breaking the build on other
arches
------------------------------+---------------------------------------------
 Reporter:  erikd             |          Owner:                  
     Type:  task              |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.5               |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 The file compiler/nativeGen/X86/Regs.hs is causing rather a lot of trouble
 for people on CPUs other than x86 and x86-86. Problems like these two:

     http://hackage.haskell.org/trac/ghc/ticket/7054

     http://hackage.haskell.org/trac/ghc/ticket/7065

 The problem is caused by code like this:

 {{{
 # if   i386_TARGET_ARCH
 someFuncion = .....
 # elif x86_64_TARGET_ARCH
 someFuncion = .....
 # else
 someFuncion = .....
 # endif
 }}}

 Code like this becomes problematic (ie fails to compile on non x86/x86-64)
 under a number of related obscure conditions like:

 * someFunction is exported from the module, but the #else part is
 forgotten, causing the compile to fail.

 * someFunction has a function signature but the #else part is forgotten
 resulting in a signature with no implmentation.

 * someFunction uses an import module on x86 or x86-64 that isn't used in
 the #else cases causing a compile error with -Werror (eg validate).

 Fortunately, I think there is a simple solution to this. If we chose one
 of these arches to be the default (say x86-64) then all instances of the
 above pattern could be rewritten as:

 {{{
 # if i386_TARGET_ARCH
 someFuncion = .....
 # else
 someFuncion = .....
 # endif
 }}}

 meaning that on PowerPC and ARM, the x86 code generator only generates
 code for x86-64 (the default), but makes the code simpler in general and
 easier to  get right.

 I am currently working on a patch which provides this functionality.

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



More information about the Glasgow-haskell-bugs mailing list