[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] bitfield handling

From: Michael Matz
Subject: Re: [Tinycc-devel] bitfield handling
Date: Wed, 3 May 2017 18:09:44 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Wed, 3 May 2017, grischka wrote:

> However, suppose we have a field with bit_pos=5,bit_size=32.
> In order to read it we need to read 40 bits, yes?  How do we
> do that on a 32-bit target, for example?

Yep, we don't (i.e. we're buggy in these cases and always were).  It's one 
example of the class of problems I'd added a comment on (tcctest.c ca. 
line 2070):

#ifndef __i386__
    /* on i386 we don't correctly support long long bit-fields.
       The bitfields can straddle long long boundaries (at least with
       GCC bitfield layout) and code generation isn't prepared for this
       (would have to work with two words in that case).  */


This also extends to long bit-fields straddling more than four bytes on 
32bit (or eight bytes on 64 bit).  Luckily those seems to happen 
relatively seldom in practice.

> Test code attached, have fun ... (no hurry ;)

He, thanks.  Yeah, eventually.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]