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

CLA compiler crashes when it sees a function pointer inside a struct. Note function pointers are not supported.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-7588
    • Hide
      C2000_21.2.0.LTS
      C2000_18.12.0.LTS
      C2000_20.2.0.LTS
      Show
      C2000_21.2.0.LTS C2000_18.12.0.LTS C2000_20.2.0.LTS
    • Hide
      C2000_20.8.0.STS*
      C2000_18.12.6.LTS
      C2000_20.2.2.LTS*
      Show
      C2000_20.8.0.STS* C2000_18.12.6.LTS C2000_20.2.2.LTS*
    • default
    • Don't put a function pointer into a struct in CLA code.
    • Hide
      Function pointers are not allowed in CLA code. When encountered, the compiler should issue a diagnostic. However, if the function pointer is a field in a struct, the compiler may crash instead. It still indicates that a function pointer may not be used, but it's unclear and shouldn't happen that way.
      Show
      Function pointers are not allowed in CLA code. When encountered, the compiler should issue a diagnostic. However, if the function pointer is a field in a struct, the compiler may crash instead. It still indicates that a function pointer may not be used, but it's unclear and shouldn't happen that way.

      Use the attached files. The file try1.cla contains these lines ...

      struct TestStruct
      {
          void (*FunPtr)(void);
      };
      
      /* Many lines later, inside a background task function */
              Test.FunPtr();
      

      Build it ...

      % cl2000 -@options.txt try1.cla
      
      INTERNAL ERROR: accla experienced a segmentation fault
                        while processing function (unknown or file scope) file (unknown) line 0
      
      This is caused by a defect in the TI C/C++ Parser.
      TI Customer Support may be able to suggest a workaround to avoid this.
      
      Upgrading to the newest version of the compiler may fix this problem.
      
      Contact TI in the E2E support forums at http://e2e.ti.com under
      "Development Tools", "TI C/C++ Compiler".  See the link titled
      "Submitting an issue".
      
      We need to see this ENTIRE error message and a complete, reproducible
      test case including ALL of the command-line options.
      Include the .pp file created by option --preproc_with_comment
      
      
      >> Compilation failure
      

      In the subset of C supported by the CLA compiler, functions pointers are not supported. Neither are functions calls from background tasks. Even so, the compiler should emit diagnostics and complete normal execution.

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

              Created:
              Updated:
              Resolved: