TI C2000 compiler failed SonarScanner analysis

  • SonarScanner-CLI 4.7
  • OS : Windows 10
  • Compiler : C2000

The build-wrapper-dump.json is created through the c/c++ build wrapper, and the following errors occur during analysis in SonarScanner.

INFO: Reached stage: parsing
INFO: Requesting reproducer for: I:/awsNode/workspace/StaticAnalysis/sonar_inverter_dartm_daily/Inverter/src/INVERTER/src/F2837xS_Spi.c
ERROR: Exception in thread pool-2-thread-9
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: I:/awsNode/workspace/StaticAnalysis/sonar_inverter_dartm_daily/Inverter/src/INVERTER/src/F2837xS_CpuTimers.c
	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:41)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1031)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

ERROR: Exception in thread pool-2-thread-7
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: I:/awsNode/workspace/StaticAnalysis/sonar_inverter_dartm_daily/Inverter/src/INVERTER/src/esc_sdo.c
	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:41)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1031)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

sonar-cfamily-reproducer.zip (60.7 KB)

Hi @Junho_Yun!

The reproducer suggests to me that the your are using a ~7 years old Texas Instruments compiler (15.12.3.LTS).
By checking the the home page of Texas Instruments, I can see that v22.6.0.LTS is the latest version.

I would recommend you upgrading your compiler to the most recent version. This would likely resolve the scanner crash as well.


The scanner crashes because this old compiler does not define the following expected predefined macros:

  • __SIZEOF_INT__
  • __SIZEOF_LONG__
  • __SIZEOF_LONG_LONG__
  • __SIZEOF_FLOAT__
  • __SIZEOF_DOUBLE__
  • __SIZEOF_LONG_DOUBLE__

The most recent version of the compiler will have these expected predefined macros, hence fixing the crash.

Alternatively, the you could experiment with manually defining the expected macros in the build script.
Note that these macros are not intended to be defined/undefined manually, they are reserved by compiler vendors so consider this only if the upgrade is out of option.
See a similar success story on the community forum.

I’ve also added this thread to the CPP-2906 ticket tracking traction of supporting old Texas Instruments compilers, although we don’t plan to take further actions.