2010-04-09 07:58 AM
COSMIC CXSTM8 - problem with if-else statemant
2011-05-17 06:07 AM
2011-05-17 06:07 AM
Hi again,
please disregard my previous message (internal misunderstanding): actually we cannot reproduce your error. Can you please send me the minimun compilable code showing the problem together with the detailed info on the version you are using? Regards, Luca (Cosmic)2011-05-17 06:07 AM
Hi Luca,
thanks for the promt reply. I took your remarks as suggestion to start further studying - so there are new findings: Now I'm sure, that the malfunction arises from the fact, that I define the structure as volatile:@tiny volatile struct flag_type flag; Hope this information will be helpful to you. Regards, WoRo2011-05-17 06:08 AM
Hello,
we still cannot see the error. Here is what we tried: #define N 1 @tiny volatile struct x { char b0:N, b1:N, b2:N; } x; void f(void) { if ((x.b0 = x.b1) == 1) x.b2 = 0; } please send us a complete example. Regards, Luca2011-05-17 06:08 AM
Hi Luca,
here my minimised program attached. Regards, WoRo2011-05-17 06:08 AM
Hi again,
new findings: Modifying your example strictly according to the rules of ANSI C, the CX educes the known malfunction.#define N 1
@tiny volatile struct x {
unsigned int b0:N, b1:N, b2:N, b3:N, b4:N, b5:N, b6:N, b7:N, b8:N; } x;void f(void)
{ if ((x.b0 = x.b1) == 1) x.b2 = 0; } Where using (unsigned) int instead of char -PLUS- a structure of more than 8bits seems to cause the failure. Regards, WoRo2011-05-17 06:08 AM