[GHC] #7984: hsc2hs --cross-compile does not handle negative #enum

GHC ghc-devs at haskell.org
Sat Jun 15 03:04:31 CEST 2013


#7984: hsc2hs --cross-compile does not handle negative #enum
-----------------------------+----------------------------------------------
Reporter:  singpolyma        |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  hsc2hs          
 Version:  7.6.3             |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  None/Unknown      |      Blockedby:                  
Blocking:                    |        Related:                  
-----------------------------+----------------------------------------------
 {{{
 #define NAME -1

 data SomeType = SomeCons Integer

 #{enum SomeType, SomeCons, NAME}
 }}}

 Output with hsc2hs or even hsc2hs --cross-safe :


 {{{
 {-# OPTIONS_GHC -optc-DNAME=-1 #-}
 {-# LINE 1 "t.hsc" #-}

 {-# LINE 2 "t.hsc" #-}

 data SomeType = SomeCons Integer

 name :: SomeType
 name = SomeCons (-1)

 {-# LINE 6 "t.hsc" #-}
 }}}

 Output with hsc2hs --cross-compile:


 {{{
 {-# LINE 1 "t.hsc" #-}
 #line 1 "t.hsc"
 #define NAME -1

 {-# LINE 2 "t.hsc" #-}

 data SomeType = SomeCons Integer

 name :: SomeType
 name = SomeCons -1

 {-# LINE 6 "t.hsc" #-}
 }}}

 Which produces a compiler error.

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



More information about the ghc-tickets mailing list