Mercurial > hg > solaris-cc-bug
comparison t2.c @ 0:e0a26cc60a20 default tip
Test for solaris cc bug with bit-fields.
With "cc -fast" (or, rather, "cc -xalias_level=basic -xO3", implied by
"cc -fast") solaris cc compiles incorrect code for bit-field accesses,
notably not rechecking data after functions calls in some situations.
Using "-xalias_level=any" resolves the problem (as well as using any
non-bit-field type).
Tested cc version is "Sun C 5.9 SunOS_i386 2007/05/03" (Sun Studio 12).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 16 Aug 2011 22:09:57 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e0a26cc60a20 |
---|---|
1 | |
2 #include "t.h" | |
3 | |
4 | |
5 void (*x)(test *t); | |
6 | |
7 | |
8 void | |
9 dosomething(test *t) | |
10 { | |
11 t->bit = 1; | |
12 } | |
13 | |
14 void | |
15 doinstall() | |
16 { | |
17 x = dosomething; | |
18 } | |
19 | |
20 int | |
21 dotest(test *t) | |
22 { | |
23 t->bit = 0; | |
24 | |
25 x(t); | |
26 | |
27 if (t->bit) { | |
28 return 0; | |
29 } | |
30 | |
31 return 1; | |
32 } |