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.

Compiler/AWR1843: number of members in a structure with C6000 CGT

Part Number: AWR1843


Tool/software: TI C/C++ Compiler

Hi Experts,

Could you please let me know about the  C674x compiler?
I am using CGTool v8.3.3 with CCS v8.3.0

Q1) What is the maximum number of members in a structure?

Q2) How can I count the number of members.
       Does any variables of one member count as one?
  If the pointer is used, is it OK to add or sub the real number?
       If there are any thing I have to pay attention, please let me know.

Q3) ANSI-C standard compliant
      According to ANSI-C(99),  It seems that 1024 members or more must be supported in a structure.
      Does the compiler for C6000 CGT v8.3.3 compliant for ANSI-C(99)?


I would like to resolve a problem that a customer has been facing.
Thank you for your kind confirmation.
Best regards,

Hitoshi

  • Hitoshi Sugawara said:
    What is the maximum number of members in a structure?

    There is no specific limit. 

    The list of structure members is allocated dynamically, so it is possible to exhaust all the memory on the host system that runs the C6000 compiler.  If that occurs, the compiler issues a diagnostic.

    It is possible to create a structure that, in terms of overall size, is too big.  If you do that, the compiler issues a diagnostic.

    Hitoshi Sugawara said:
    How can I count the number of members.
           Does any variables of one member count as one?

    I'm not sure what you mean.  The compiler has no feature which supports counting the number of members in a structure.

    Hitoshi Sugawara said:
    If the pointer is used, is it OK to add or sub the real number?

    I'm not sure what pointer you mean.  Please show me an example.

    Hitoshi Sugawara said:
    According to ANSI-C(99),  It seems that 1024 members or more must be supported in a structure.

    The standard requires support for a minimum of "1023 members in a single structure".

    Hitoshi Sugawara said:
    Does the compiler for C6000 CGT v8.3.3 compliant for ANSI-C(99)?

    Yes.

    Thanks and regards,

    -George

  • Hi George,
    Thank you for prompt reply.
    Let me clarify a couple things as follows:

    Q4)  "It is possible to create a structure that, in terms of overall size, is too big.  If you do that, the compiler issues a diagnostic."

    I would like to utilize this function.
    Could you please let me know the procedure how to get the diagnostic result?

    Q5)  "The list of structure members is allocated dynamically,"

    When the program runs and makes like heap memory dynamically, is it possible to issue a diagnostic?
    Even though the compile is done with no problem however, the memory could run out  by the operation.

    Q6) Is there any way to check the memory size which must be sufficient for the application?

    Best regards,
    Hitoshi

  • Hi George,
    Could you please let us know how to issue a diagnostic?
    It should be very helpful for the development.

    Thank you in advance for your kind training me.
    Best regards,
    HItoshi

  • Hitoshi Sugawara said:
    Could you please let us know how to issue a diagnostic?

    Here is one demonstration of that diagnostic.

    C:\test_dir>type file.c
    /* Gets diagnostic */
    struct too_big
    {
       int array[(1LL << (31-sizeof(int)))];
    } tb;
    
    /* No diagnostic */
    struct too_big_minus_one
    {
       int array[(1LL << (31-sizeof(int)))-1];
    } tb1;
    
    
    C:\test_dir>cl6x file.c
    "file.c", line 2: error: struct or union is too large
    1 error detected in the compilation of "file.c".
    
    >> Compilation failure

    Thanks and regards,

    -George