cancel
Showing results for 
Search instead for 
Did you mean: 

COSMIC CXSTM8 - problem with if-else statemant

wolfgang239955_stm1_st
Associate II
Posted on April 09, 2010 at 16:58

COSMIC CXSTM8 - problem with if-else statemant

7 REPLIES 7
luca239955_stm1_st
Senior II
Posted on May 17, 2011 at 15:07

Hi,

we confirm this is a problem in the compiler, please contact me via email (luca.ubiali@cosmic.fr) for the solution.

Regards,

Luca (Cosmic)

luca239955_stm1_st
Senior II
Posted on May 17, 2011 at 15:07

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)

wolfgang239955_stm1_st
Associate II
Posted on May 17, 2011 at 15:07

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,

WoRo

luca239955_stm1_st
Senior II
Posted on May 17, 2011 at 15:08

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,

Luca

wolfgang239955_stm1_st
Associate II
Posted on May 17, 2011 at 15:08

Hi Luca,

here my minimised program attached.

Regards,

WoRo

wolfgang239955_stm1_st
Associate II
Posted on May 17, 2011 at 15:08

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, WoRo

luca239955_stm1_st
Senior II
Posted on May 17, 2011 at 15:08

Hi Woro,

we fixed the problem, thank you for your analysis.

Regards,

Luca