C compiler: System Error: S9xx internal consistency check failed - please report

24-Oct-2024

System errors such as S900, S903, S911, and S917 indicate an internal problem with the C compiler. There is a good chance this is caused by an issue with a certain C compiler optimization. Therefore, disabling this optimization might be a possible mitigation.


Possible solution

To determine whether an optimization causes the problem, you can follow these steps:

1. Disable all optimizations by specifying the C compiler option -O0, or by adding the following pragma at the beginning of the affected C source file:

#pragma optimize 0

 2. If the S9xx error disappears after this change, you can do further tests to determine which optimization exactly causes the problem. You can first try to enable some optimizations, by specifying -O1, or by adding the following pragma at the beginning of the affected C source file:

#pragma optimize 1

3. If the problem still doesn't show up, you can try the option -O2, or add the following pragma at the beginning of the affected C source file:

#pragma optimize 2

4. When the problem shows up, you need to compare the compiler optimization settings between the working and non-working versions.

For example, if the problem shows up when optimization level 1 is used but does not show up when optimization level 0 is used, you can compare the optimization settings of both levels which are:

-O0 is an alias for -OaCEFGIKLMNOPRSUVWY,-predict
-O1 is an alias for -OaCefgIKLMNOPRSUVWy,+predict

Then you can continue to locate the single optimization that causes the problem, by switching off individual optimizations. For example, use -OF or use the below pragma to disable the control flow optimization to determine if the problem persists.

#pragma optimize F

You can control these Compiler optimization options from the Eclipse GUI as well. For more information, see Chapter Compiler Optimizations in the product user guide.

5. If switching off an optimization does not solve the problem, for further investigation, our support staff needs a preprocessed version of the affected C source code along with the C compiler options you are using. You can create this by adding the option -ECp to the C compiler options. Then a preprocessed file is created instead of a .src file for the assembler.

Even if you find a mitigation, we encourage you to send this preprocessed C source file so that we can find out whether this is a known issue or a new one, as almost all S9xx errors will be fixed in an upcoming release.

Was this answer helpful?