This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Switch statement does not work

Hi,

I have a switch statement with 17 cases and default case. My software starts misbehaving. If I reduce the number of cases to 16 and default case, my software behaves correctly. Looking at the disassembly listing, the generated code for the 17 cases switch statement was using a jump table. Is this a known issue?

My set the optimization level to O1, --opt_for_speed, and --optimize_with_debug.

  • Nguyen Nguyen2 said:
    My software starts misbehaving.

    Exactly what goes wrong, and how do you see it?

    We need a test case which allows us to reproduce this behavior.  It does not have to run.  We only build it down to assembly language.  Change the code back to the problem state.  Then preprocess it.  Which compiler do you use?  What is the compiler (not CCS) version?  Please show all the build options exactly as the compiler sees them.

    Thanks and regards,

    -George

  • Hi George,

    It's my bad. My hex2bin script did not include the .switch section.

    Sorry :)

    -nguyen