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.

TMS Compiler "INTERNAL ERROR: Decomposition error. Serious Please Get Help!"

Other Parts Discussed in Thread: CCSTUDIO, OMAP3530

I'm using the TMS compiler as a standard part of the CCSV5.1 distribution, build a CCStudio project, originally based on HelloWorld template.  I define a structure in this way...

"

typedef struct configuration{
union {
    uint32_t field1;
    struct {
    uint32_t field2:16;
    uint32_t field3:12;
    uint32_t field4:4;
    };
};
    uint32_t x;
    uint32_t y;
    uint32_t z;

"

This is structure is perfectly fine under gcc.  Yet under the CCStudio when I access field2, field3, or field4 it yells at me..."  INTERNAL ERROR: Decomposition error.  Get help soon!  Cannot continue compilation - ABORTING! "

Is there something non-standard about my union declaration within a structure?  My target is OMAP3530 ARM core.

  • Yes, you are using both an anonymous union and an anonymous struct, which is not defined by the C standard, but is provided as an extension by GCC.  You should be able to compile this by using the --gcc command-line option.

  • thanks for the quick answer.  still doesn't seem to be supported even with -gcc option.  I'll try to find another way to express this...

  • Whether or not this is the correct way to write it, the compiler should never emit an internal error.  Could you post a compilable test case, with the command-line options you are using, so that we can fix the problem?

  • edit mini.c:

    #include <stdint.h>
    #include <stdio.h>

    struct bit_field {
        uint32_t field1:16;
        uint32_t field2:12;
        uint32_t field3:4;
    };

    union myunion {
        struct bit_field my_bit_field;
        int x;
        int y;
        int z;
    };

    struct configuration{
        union myunion union_field;

        uint32_t field4;
        uint32_t field5;
    } __attribute__ ((packed));

    int main(void) {
        struct configuration *config;

        printf("%d %d %d\n", config->union_field.my_bit_field.field1,
                              config->union_field.my_bit_field.field2,
                             config->union_field.my_bit_field.field3);

    }

    compiling...

    C:\ti\ccsv5\utils\bin\gmake -k common/mini.obj
    'Building file: ../common/mini.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv5/tools/compiler/tms470/bin/cl470" -mv7A8 --code_state=32 --abi=eabi -me -g --include_path="C:/ti/ccsv5/tools/compiler/tms470/include" --gcc --diag_warning=225 --display_error_number -mt --preproc_with_compile --preproc_dependency="common/mini.pp" --obj_directory="common"  "../common/mini.c"
    "../common/mini.c", line 27: warning #551-D: variable "config" is used before its value is set
    >> ../common/mini.c, line 27: INTERNAL ERROR: Decomposition error


    This may be a serious problem.  Please contact customer support with a
    description of this problem and a sample of the source files that caused this
    INTERNAL ERROR message to appear.

    Cannot continue compilation - ABORTING!


    >> Compilation failure
    gmake: *** [common/mini.obj] Error 1

    **** Build Finished ****


    The achilles heal is the "attribute packed" applied against this structure.

    A suggestion for a workaround would be appreciated.

    Best regards,

    Eric Texley

  • The problem is the packed attribute; most likely that you are trying to pack an aggregate containing a bit-field.  The web page noted below specifically forbids packed bit-fields for compiler versions before 4.8.0.  What compiler version are you using (not the CCS version)?

    http://processors.wiki.ti.com/index.php/GCC_Extensions_in_TI_Compilers

  • Yes.  It works without the packed attribute:

    GCC likes it:

    $ gcc --version
    gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
    Copyright (C) 2004 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    erict@ERIC_T ~
    $ gcc mini.c

    Here's my TMS compiler version:

    C:\ti\ccsv5\tools\compiler\tms470\bin>cl470 -version
    TMS470 C/C++ Compiler                   v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 C/C++ Parser                     v4.9.1
    Build Number 1LJ9T-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 EABI C/C++ Parser                v4.9.1
    Build Number 1LJ9T-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 C/C++ File Merge                 v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 C/C++ Optimizer                  v4.9.1
    Build Number 1LJ9T-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 C/C++ Codegen                    v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Assembler                        v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Embed Utility                    v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 C Source Interlister             v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Linker                           v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Absolute Lister                  v4.9.1
    Build Number 1LJ9T-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Strip Utility                    v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 XREF Utility                     v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 C++ Demangler                    v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Hex Converter                    v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Library Builder                  v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Name Utility                     v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Object File Display              v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R
    TMS470 Archiver                         v4.9.1
    Build Number 1LJ9U-KDADEMDK-RTARQ-TAV-ZAZE_U_Z9_R

  • Okay, I think it should work, but I'm not very sure.  Unfortunately our "packed" expert is not available right now.  I've submitted defect report SDSCM00043502 to track this issue.

  • This is still a bug.

    >> ../APP/panel_handler.c, line 2653: INTERNAL ERROR: Decomposition error


    This may be a serious problem. Please contact customer support with a
    description of this problem and a sample of the source files that caused this
    INTERNAL ERROR message to appear.

    Cannot continue compilation - ABORTING!


    >> Compilation failure

    This works:

    // A map for a single switch
    // 3 bytes
    struct panel_switch_map_str {
      uint8_t control_id;
      union {
        uint16_t control_codes;
        struct {
          uint8_t close_latch_pulse_on :1;
          uint8_t toggle :1;
          uint8_t active_when_off :1;
          uint8_t always_enable :1;
          uint8_t :4;
          uint8_t accept_buzzer_id :3;
          uint8_t reject_buzzer_id :3;
          uint8_t :2;
        };
      };
    }__attribute__ ((packed));

    This fails:

    // A map for a single switch
    // 3 bytes
    struct panel_switch_map_str {
      uint8_t control_id;
      union {
        uint16_t control_codes;
        struct {
          uint16_t close_latch_pulse_on :1;
          uint16_t toggle :1;
          uint16_t active_when_off :1;
          uint16_t always_enable :1;
          uint16_t accept_buzzer_id :3;
          uint16_t reject_buzzer_id :3;
          uint16_t :6;
        };
      };
    }__attribute__ ((packed));

    Compiler version 4.9.7. Should not give an internal error, and should work for either case.
    Josh
  • That's correct, SDSCM00043502 has not yet been fixed.

  • Thanks Archaeologist,

    Can you please tell me where I can look at these bug reports, so I can track the ones that affect me, or is the code you provided internal use only?

    Regards,

    Josh

  • You can track this bug using SDOWP