Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11373

Compiler crashes on switch statement with hundreds of thousands of case labels

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • Code Generation Tools
    • CODEGEN-11322
    • C2000_22.6.0.LTS
    • default
    • Rewrite the switch to use if/then statements checking the range of the input.
    • Hide
      The compiler has trouble handling switch statements with a very large number of case labels. Using the GNU-like extension of case label ranges is an easy way to create a very large number of case labels, which can quickly overflow the compiler's call frame stack.
      Show
      The compiler has trouble handling switch statements with a very large number of case labels. Using the GNU-like extension of case label ranges is an easy way to create a very large number of case labels, which can quickly overflow the compiler's call frame stack.

      The attached source file contains switch case ranges such as ...

      	case RAMLS0_BASE_ADDR ... RAMD1_LAST_ADDR:
      	f1();
      	break;
      

      Build it ...

      $ cl2000 file.c
      
      >> Compilation failure
      

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: