Skip to Content.
Sympa Menu

c-semantics - [C-Semantics] split vote!

c-semantics AT lists.cs.illinois.edu

Subject: C Semantics in K Framework

List archive

[C-Semantics] split vote!


Chronological Thread 
  • From: John Regehr <regehr AT cs.utah.edu>
  • To: c-semantics AT cs.illinois.edu
  • Subject: [C-Semantics] split vote!
  • Date: Tue, 12 Jul 2011 13:56:30 -0600
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/c-semantics>
  • List-id: C Semantics in K Framework <c-semantics.cs.illinois.edu>

GCC and KCC give one answer, ICC and Clang give another -- all with optimizations disabled. Can any of the C experts here tell me who is wrong?

I'm pretty sure the test case is well-defined (but never 100% sure with this kind of thing).

John



[regehr@babel
~]$ cat small.c
int printf (const char *, ...);

struct S0
{
unsigned f1:1;
};

struct S2
{
struct S0 f2;
};

struct S2 g_791;

int main (void)
{
int l_45 = -3;
int t = l_45 >= (0, g_791.f2.f1);
printf ("%d\n", t);
return 0;
}
[regehr@babel
~]$ gcc small.c
[regehr@babel
~]$ ./a.out
0
[regehr@babel
~]$ kcc small.c
[regehr@babel
~]$ ./a.out
0
[regehr@babel
~]$ clang small.c
small.c:18:20: warning: expression result unused [-Wunused-value]
int t = l_45 >= (0, g_791.f2.f1);
^
1 warning generated.
[regehr@babel
~]$ ./a.out
1
[regehr@babel
~]$ icc small.c
[regehr@babel
~]$ ./a.out
1




Archive powered by MHonArc 2.6.16.

Top of Page