Mercurial > hg > solaris-cc-bug
diff 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 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/t2.c @@ -0,0 +1,32 @@ + +#include "t.h" + + +void (*x)(test *t); + + +void +dosomething(test *t) +{ + t->bit = 1; +} + +void +doinstall() +{ + x = dosomething; +} + +int +dotest(test *t) +{ + t->bit = 0; + + x(t); + + if (t->bit) { + return 0; + } + + return 1; +}