ADS MISRA check failed ctc S900

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
huskie
Level 2
Level 2
5 replies posted First solution authored 10 sign-ins

Hi :

 

我在使用ADS1.8编译一组代码的时候,编译器提示错误ctc S900: internal consistency check failed - please report

huskie_0-1670310367333.png

这个错误可能和MISRA检查有关。

huskie_1-1670310518415.png

我想请问一下在ADS哪里设置可以关闭这个检查,避免这个错误警告?

 

thanks 

 

-----

Hi :

When I compile a set of code with ADS1.8, the compiler prompts the error ctc S900: Internal consistency check failed - please report

This error may be related to the MISRA check.

I would like to ask where in the ADS setting can I turn off this check and avoid this false warning?

thanks 

 

0 Likes
1 Solution

 

Thank you very much for helping me solve this problem

View solution in original post

0 Likes
5 Replies
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Huskie, this issue is from Tasking VX-tool compiler.  @User13836, could you please help? 

0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins

Hello. This indicates a C compiler issue when a C specific source file is compiled. I suppose it's not related to the MISRA C checker, because this is not enabled in the ADS product. It can be enabled for the TASKING TriCore product.

To mitigate this issue it might be possible to disable the optimization which provokes the problem. To do so you first need to figure out which C source file is provoking the problem. After this file has been located you can proceed as follows:

Please add the line:

#pragma optimize 0

at the beginning of the affected C source file. If the S9xx error disappears after this change you can do further tests to determine which optimization exactly causes the trouble.

The guideline is:

#pragma optimize 0cef

If this still works then:

#pragma optimize 0gik

If this still works then:

#pragma optimize 0lmn

If this still works then:

#pragma optimize 0opr

If this still works then:

#pragma optimize 0suvwy

For the branch which fails you can disable the individual optimizations. E.g. if the error shows up when:

#pragma optimize 0cef

is used then you can try:

#pragma optimize 0c

and

#pragma optimize 0e

and

#pragma optimize 0f

to enable the individual optimizations. If it turns out that

#pragma optimize 0f

is causing the trouble then the control flow simplification must be disabled to prevent the problem.

Then the smart mitigation is to use:

#pragma optimize F

in the affected C source file.

 

Best regards,
Ulrich Kloidt

TASKING tools support

0 Likes

Hi :

目前在C文件的前面加上#pragma optimize 0 ,但是S9XX错误依然存在。

目前CCTC的命令参数是

cctc -D__CPU__=tc39xb "-fC:/Users/WAN/Desktop/Adapter/Debug/TASKING_C_C___Compiler-Include_paths.opt" --iso=99 --c++14 --language=+volatile --exceptions --anachronisms --fp-model=3 -O0 --tradeoff=4 --compact-max-size=200 -g -Wc-w544 -Wc-w557 -Ctc39xb -o "LittleFS/lfs.src" "../LittleFS/lfs.c" -cs --dep-file="LittleFS/lfs.d" --misrac-version=2012 -N0 -Z0 -Y0 2>&1;

这个S9XX错误的产生可能会和W5XX的警告有关吗?

huskie_0-1670385014295.png

 

Best regards,

——————————

Hi :

Currently adding #pragma optimize 0 in front of the C file, but the S9XX error persists.

Currently the command parameters for CCTC are

cctc -D__CPU__=tc39xb "-fC:/Users/WAN/Desktop/Adapter/Debug/TASKING_C_C___Compiler-Include_paths.opt" --iso=99 --c++14 --language=+volatile --exceptions --anachronisms -- fp-model=3 -O0 --tradeoff=4 --compact-max-size=200 -g -Wc-w544 -Wc-w557 -Ctc39xb -o "LittleFS/lfs.src" ".. /LittleFS/lfs.c" -cs --dep-file="LittleFS/lfs.d" --misrac-version=2012 -N0 -Z0 -Y0 2>&1;

Could this S9XX error be related to the W5XX warning?

 

@User13836 

0 Likes
lock attach
Attachments are accessible only for community members.

Many thanks for the update. This information is helpful. You are using the little file system application code as it looks like. The following known issue does exist, related to the lfs.c source file:

TCVX-44933 C compiler error S900 internal consistency check failed - please report

DESCRIPTION
The example code listed below does provoke the C compiler error message:

    S900: internal consistency check failed - please report

Example:
    /* file_1.c */
    #include <stdio.h>

    typedef unsigned int my_tag_t;

    struct my_mattr {
        my_tag_t tag;
        const void *buffer;
    };

    #define MY_MKTAG(type, id, size) \
        (((my_tag_t)(type) << 20) | ((my_tag_t)(id) << 10) | (my_tag_t)(size))

    #define MY_MKTAG_IF(cond, type, id, size) \
        ((cond) ? MY_MKTAG(type, id, size) : MY_MKTAG(0, 0, 0))

    #define MY_ATTRS(...) \
        sizeof((struct my_mattr[]){__VA_ARGS__}) / sizeof(struct my_mattr)

    void myfunc(int num)
    {
        printf("%d\n", num);
    }

    int main(int argc)
    {
        myfunc(MY_ATTRS(
            {MY_MKTAG_IF(argc != 0x3ff, 4, argc, 0), NULL}));
        return 0;
    }

Invocation:
For TriCore and SmartCode product:
    ctc file_1.c
For ARM and HSM:
    carm file_1.c
For PCP:
    cpcp file_1.c
For MCS/GTM:
    cmcs file_1.c
For 8051:
    c51 file_1.c
For ARC/PPU;
    carc file_1.c

MITIGATION
Introduce a local variable which contains the MY_MKTAG_IF macro result and replace the macro by the local variable in the MY_ATTRS macro invocation.

    int main(int argc)
    {
    #ifdef MITIGATE
        my_tag_t temp_tag1 = MY_MKTAG_IF(argc != 0x3ff, 4, argc, 0);
        myfunc(MY_ATTRS(
            {temp_tag1, NULL}));
    #else
        myfunc(MY_ATTRS(
            {MY_MKTAG_IF(argc != 0x3ff, 4, argc, 0), NULL}));
    #endif
        return 0;
    }

 

I enclosed a modified version of the lfs.c file which you can use instead of the original one to mitigate this issue.

Best regards,
Ulrich Kloidt

TASKING tools support

 

Thank you very much for helping me solve this problem

0 Likes