c-semantics AT lists.cs.illinois.edu
Subject: C Semantics in K Framework
List archive
- From: John Regehr <regehr AT cs.utah.edu>
- To: c-semantics AT cs.illinois.edu
- Subject: Re: [C-Semantics] unnamed struct members
- Date: Tue, 09 Aug 2011 13:19:03 -0600
- List-archive: <http://lists.cs.uiuc.edu/pipermail/c-semantics>
- List-id: C Semantics in K Framework <c-semantics.cs.illinois.edu>
Hi Derek,
I can't find any language in the C99 standard which forces unnamed struct members to be bitfields. Rather, we see text like this which appears to refer to all member objects:
"A structure type describes a sequentially allocated nonempty set of member objects (and, in certain circumstances, an incomplete array), each of which has an optionally specified name and possibly distinct type."
Can you back up your interpretation?
Thanks,
John
On 8/9/11 1:06 PM, Derek M Jones wrote:
John,
The C99 standard seems to make it clear that structs may contain unnamed
members. This argues that KCC and CompCert are correct.
Unnamed BIT-FIELD members.
Both Clang and GCC (even when given the --std=c99 flag) complain that
line 5 does not declare anything, and their output is consistent with
this claim.
This is correct.
Anyone know what's going on?
The code is making use of an extension to C.
Thanks,
John
int printf (const char *, ...);
struct S0
{
int;
int f1;
};
struct S3
{
int f2;
int f3;
};
union U4
{
struct S3 f0;
struct S0 f3;
};
union U4 g_110;
int main (void)
{
g_110.f3.f1 = 1;
printf ("%d\n", g_110.f0.f2);
return 0;
}
_______________________________________________
c-semantics mailing list
c-semantics AT cs.illinois.edu
http://lists.cs.uiuc.edu/mailman/listinfo/c-semantics
- [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, Derek M Jones, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, CUOQ Pascal, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, Derek M Jones, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, Derek M Jones, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, CUOQ Pascal, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, Derek M Jones, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, CUOQ Pascal, 08/09/2011
- Re: [C-Semantics] unnamed struct members, John Regehr, 08/09/2011
- Re: [C-Semantics] unnamed struct members, Derek M Jones, 08/09/2011
Archive powered by MHonArc 2.6.16.