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: [C-Semantics] unnamed struct members
- Date: Tue, 09 Aug 2011 12:47:52 -0600
- List-archive: <http://lists.cs.uiuc.edu/pipermail/c-semantics>
- List-id: C Semantics in K Framework <c-semantics.cs.illinois.edu>
This seemed interesting enough to pass along.
CompCert and KCC give 0 for the program below but GCC and Clang give 1.
This is all on x86.
The C99 standard seems to make it clear that structs may contain unnamed members. This argues that KCC and CompCert are correct.
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.
Anyone know what's going on?
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] 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.