[GHC] #12149: Support bit-fields

GHC ghc-devs at haskell.org
Fri Jun 3 14:23:12 UTC 2016


#12149: Support bit-fields
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:
  facundo.dominguez                  |
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  hsc2hs         |           Version:  8.0.1
           Keywords:  bit-fields     |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Having C type like:
 {{{
 typedef struct S {
   int f0: 1;
   int f1: 15;
 } S;
 }}}
 and {{{hsc}}} code like
 {{{
 #{peek S, f0} p
 }}}
 Causes {{{hsc2hs}}} to fail with
 {{{
 error: attempt to take address of bit-field structure member 'f0'
 }}}
 Apparently this is an error from gcc, which cannot provide the address of
 bit-fields. However, in Haskell we are not interested in the address of
 the bit-field but in its value.

 It would be useful to have a way to get and set the values of these
 fields.

 Some former discussion [https://mail.haskell.org/pipermail/haskell-
 cafe/2008-November/050317.html here]

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


More information about the ghc-tickets mailing list