GCC optimisations / assembler error?

Comments

3 comments

  • Avatar
    VEIT Electronics - Martin Dušek

    Hi!

    I don't see anything strange about the examples you attached.

    When optimizing, the compiler assumes, that there is nothing inside while loop that can change the value of SymbolTimingBit, so it produces infinite loop.

    Declare SymbolTimingBit variable as "volatile".

    0
    Comment actions Permalink
  • Avatar
    Glen English

    Hi Martin 

    Thanks for looking. Much appreciated. It IS declared as volatile...... strange huh ?
    I do like your explanation. Makes sense.  
    OK  so it is declared as volatile. But. I smell a rat....
    Yes in my globals.c I have it as

    volatile bool SymbolTimingBit;

    but in my globals.h

    extern volatile bool SymbolTimingBit;

     

    That was it. Nice one Martin. cheers

     

    0
    Comment actions Permalink
  • Avatar
    Glen English

    but in my globals.h

    extern bool SymbolTimingBit;

     

    not volatile storage modifier. woops!

    0
    Comment actions Permalink

Please sign in to leave a comment.