[Top][All Lists]

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

Re: [Tinycc-devel] Weird bitfield size handling, discrepancy with gcc

From: Michael Matz
Subject: Re: [Tinycc-devel] Weird bitfield size handling, discrepancy with gcc
Date: Mon, 24 Oct 2016 17:57:35 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Thu, 20 Oct 2016, David Mertens wrote:

> > For instance, this is wrong for PCC layout.  MS layout indeed switches
> > storage containers when the base type changes, i.e. here:
> >
> > struct S {
> >   char  c:1;
> >   short s:1;
> >   char foo;
> > };
> >
> > PCC layout has no such provisions.  But the base type _does_ influence
> > alignment of the containing struct nevertheless.  Except if the bitfield
> > has :0 size, then it _does_ force the next field to be placed into a new
> > storage container.  It's all quite terrible and twisted :-/
> >
> I question the wisdom of targeting the binary layout of pcc.

Sorry, maybe I wasn't clear enough.  The traditional PCC layout _is_ the 
GCC layout on most targets.  (That PCC only has few things in common with 
the current pcc project used by some BSDs).

> It's a neat compiler, with an aim similar to tcc, but developer time and 
> resources are limited. I'd vote for just MSVC and GCC compatibility as a 
> start. (Presumably we get clang for free with that.) If anybody later 
> comes along with inclination, they can extend it to handle PCC layout.

Perhaps I shouldn't have confused matters more, but the problem I had was 
that talking about "the" GCC layout would be wrong as well, as it itself 
tries to follow vendor compilers where they exist :)  It just so happens 
that if GCC is the "vendor" compiler (which it is for many recent 
architectures) and there's nothing specific in the psABI from the vendor 
(there is for instance for ARM) it often uses the same layout rules like 
the very old PCC compiler did for many Unixes (mostly because the usual 
ports people copy their initial version from simply has 

So, that's why I talked about PCC layout because it specifies a certain 
set of rules.  MS layout as well.  So, yes, I agree that that would be the 
choice, MS layout or "GCC" layout (aka PCC layout :) ).

And yes, that would be an option (or perhaps a compile time default 
depending on the target).


reply via email to

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