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/C6000-CGT: Compiler 8.3.6 [Target DSP: TMDSEVM6678LE ]: Why I can't declare a map argument for a function?

Part Number: C6000-CGT


Tool/software: TI C/C++ Compiler

I am trying to declare a c++ function that takes a map as argument but not working .... 

Please let me know your comments, thx

#include <iostream>
#include <cstdlib>
#include <cstring>
#include <map>

#include <regex>

#include "ark_premitive_data_types.h"

using namespace std;

#define MAXCHAR 10000

typedef struct ark_field_entry {
    public:
        std::string name;
        std::string type;
        dt_int32 ncols;
        dt_int32 nrows;
    } ark_field_entrt;


void print_hmap_el(std::map<string, ark_field_entry> hmap, string key){ // << HERE

    cout << "hmap[key]: \n" \
            << "\t name: " << hmap[key].name << endl \
            << "\t type: " << hmap[key].type << endl \
            << "\t nrows: " << hmap[key].nrows << endl \
            << "\t ncols: " << hmap[key].ncols << endl;
}

int main(){
    std::map<std::string, ark_field_entry> retmap;
    cout << "-= Program Done =-" << endl;
}

The error is as below:


**** Build of configuration Debug for project whiteboard ****

"C:\\ti\\ccs920\\ccs\\utils\\bin\\gmake" -k -j 8 all -O

Building file: "../test_json.cpp"
Invoking: C6000 Compiler
"C:/ti/ccs920/ccs/tools/compiler/ti-cgt-c6000_8.3.6/bin/cl6x" -mv6600 --include_path="C:/Users/Mehdi-laptop/workspace_v9_2/whiteboard" --include_path="C:/ti/ccs920/ccs/tools/compiler/ti-cgt-c6000_8.3.6/include" -g --c99 --c++14 --diag_warning=225 --diag_wrap=off --display_error_number --openmp --preproc_with_compile --preproc_dependency="test_json.d_raw" --cmd_file="configPkg/compiler.opt" "../test_json.cpp"

>> Compilation failure
subdir_rules.mk:23: recipe for target 'test_json.obj' failed

INTERNAL ERROR: C:\ti\ccs920\ccs\tools\compiler\ti-cgt-c6000_8.3.6\bin\acpia6x.exe experienced a segmentation fault
while processing function (unknown or file scope) file ../test_json.cpp line 79

This is caused by a defect in the TI EABI 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

gmake: *** [test_json.obj] Error 1
gmake: Target 'all' not remade because of errors.

  • Mike ITGeek said:
    Please let me know your comments, thx

    I attempted to investigate with your example code, but since the contents of ark_premitive_data_types.h wasn't shown had to guess at:

    //#include "ark_premitive_data_types.h"
    typedef unsigned int dt_int32;

    In case you haven't seen it, How to Submit a Compiler Test Case has some guidance on how to submit a pre-processed example,

    With the following options I get a crash:

    Building file: "../main.cpp"
    Invoking: C6000 Compiler
    "/home/mr_halfword/ti/ccs1000/ccs/tools/compiler/ti-cgt-c6000_8.3.6/bin/cl6x" -mv6600 --include_path="/home/mr_halfword/workspace_v10/C66_map_func_arg" --include_path="/home/mr_halfword/ti/ccs1000/ccs/tools/compiler/ti-cgt-c6000_8.3.6/include" -g --c99 --diag_warning=225 --diag_wrap=off --display_error_number --openmp --preproc_with_compile --preproc_dependency="main.d_raw"  "../main.cpp"
     
    >> Compilation failure
    subdir_rules.mk:7: recipe for target 'main.obj' failed
     
    INTERNAL ERROR: /home/mr_halfword/ti/ccs1000/ccs/tools/compiler/ti-cgt-c6000_8.3.6/bin/acpia6x experienced a segmentation fault
                      while processing function (unknown or file scope) file ../main.cpp line 24
     
    This is caused by a defect in the TI EABI 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

    I removed the --openmp option the crash no longer occurs:

    Invoking: C6000 Compiler
    "/home/mr_halfword/ti/ccs1000/ccs/tools/compiler/ti-cgt-c6000_8.3.6/bin/cl6x" -mv6600 --include_path="/home/mr_halfword/workspace_v10/C66_map_func_arg" --include_path="/home/mr_halfword/ti/ccs1000/ccs/tools/compiler/ti-cgt-c6000_8.3.6/include" -g --c99 --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="main.d_raw"  "../main.cpp"
    Finished building: "../main.cpp"

    Do you need to use support for OpenMP in your program?

  • Thanks for your response, 

    That's right ... dt_int32 is the int type for us ... 

    Yes, we need OpenMP ...we have many (around 20) C/C++ code files ... and we had to change the software side since C6000 doesn't support OpenMP for C++ files ... so we use C extern declarations and we do the OpenMP stuff in C code (no OpenMP in C++) ... "I hope it works ... "

    So I guess my question would be what guidelines/practices we should follow to avoid compiler segmentation fault issues like above.. I guess I don't know what the best practice is to compile C and C++ as you suggested .... because I can only enable and disable openmp from Props > C6000 Compiler > Advanced Options > Advanced Optimization for the entire project I am not sure how to disable it ONLY for C++ code and enable for C codes ONLY...

    Please provide comments ... Regards

  • Mike ITGeek said:
    because I can only enable and disable openmp from Props > C6000 Compiler > Advanced Options > Advanced Optimization for the entire project I am not sure how to disable it ONLY for C++ code and enable for C codes ONLY...

    CCS allows for File Specific Options. With that you can enable --openmp at the project level, and then manually remove --openmp on specific C++ source files which cause the compiler crash.

    This would be a work-around until TI can identify and fix the compiler crash.

    Mike ITGeek said:
    so we use C extern declarations and we do the OpenMP stuff in C code (no OpenMP in C++) ... "I hope it works ... "

    I haven't used OpenMP myself, so will leave TI to comment on that.

  • When even building C++ source files like test_json.cpp, do not use the compiler option --openmp.  When you remove that option, does the problem still occur?  If yes, then for that source file, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Yeah of course thanks ... M