[ParsingError] An error occurred while analyzing the following compilation unit

SonarQube: Version 9.9
Scanner: build-wrapper, version 6.41 (win-x86-64)
Plugin: CFamily plugin version: 6.41


While trying to analyze a project I am getting the following errors:

2023-12-06T15:25:42.4722180Z 09:25:42.468 ERROR: Exception in thread pool-4-thread-25
2023-12-06T15:25:42.4722316Z com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code -1073741676: C:/build_agent/1/s/APP/Middleware/CANopen/SignOn/spf_coso2_slave.c
2023-12-06T15:25:42.4722409Z 	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:40)
2023-12-06T15:25:42.4722485Z 	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
2023-12-06T15:25:42.4722564Z 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1074)
2023-12-06T15:25:42.4722650Z 	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
2023-12-06T15:25:42.4722735Z 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
2023-12-06T15:25:42.4722808Z 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2023-12-06T15:25:42.4722891Z 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
2023-12-06T15:25:42.4722978Z 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
2023-12-06T15:25:42.4723051Z 	at java.base/java.lang.Thread.run(Thread.java:833)
2023-12-06T15:25:50.7594377Z An error occurred while analyzing the following compilation unit: 
2023-12-06T15:25:50.7594780Z   C:/build_agent/1/s/APP/F28335/SPEPC003/DspLV/Diagnostics/spepc003dsp1_adf_main.c
2023-12-06T15:25:50.7594981Z A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
2023-12-06T15:25:50.7595086Z Please contact SonarSource support providing the following file to help improving the analyzer:
2023-12-06T15:25:50.7595201Z   C:\build_agent\1\s\sonar-cfamily-reproducer.zip
2023-12-06T15:25:50.7595227Z 
2023-12-06T15:25:50.7595286Z 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:442)
2023-12-06T15:25:50.7595371Z 	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
2023-12-06T15:25:50.7595810Z 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
2023-12-06T15:25:50.7595913Z 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
2023-12-06T15:25:50.7596012Z 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
2023-12-06T15:25:50.7596163Z 	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
2023-12-06T15:25:50.7596266Z 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
2023-12-06T15:25:50.7596371Z 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
2023-12-06T15:25:50.7596481Z 	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
2023-12-06T15:25:50.7596662Z 	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
2023-12-06T15:25:50.7596772Z 	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
2023-12-06T15:25:50.7596873Z 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
2023-12-06T15:25:50.7596971Z 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
2023-12-06T15:25:50.7597070Z 	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
2023-12-06T15:25:50.7597176Z 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
2023-12-06T15:25:50.7597273Z 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
2023-12-06T15:25:50.7597363Z 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
2023-12-06T15:25:50.7597435Z 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
2023-12-06T15:25:50.7597529Z 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2023-12-06T15:25:50.7597617Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-12-06T15:25:50.7597708Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2023-12-06T15:25:50.7597805Z 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-12-06T15:25:50.7598068Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2023-12-06T15:25:50.7598171Z 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2023-12-06T15:25:50.7598388Z 	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2023-12-06T15:25:50.7598465Z 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2023-12-06T15:25:50.7598563Z 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2023-12-06T15:25:50.7598648Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2023-12-06T15:25:50.7598729Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2023-12-06T15:25:50.7598798Z 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2023-12-06T15:25:51.3697380Z ##[error]Cmd.exe exited with code '1'.
2023-12-06T15:25:51.3878675Z ##[section]Finishing: Sonar

Looking through the log, I saw parsing errors like this:

 Reproducer logs:
2023-12-06T15:25:29.5562413Z 09:25:29.555 DEBUG: [ParsingError] C:/build_agent/1/s/APP/F28335/SPEPC003/DspLV/Build/BootloaderBased/../../../../../Middleware/Diagnostics/adf_specs.h:56 integer literal is too large to be represented in any integer type
2023-12-06T15:25:29.5562785Z 09:25:29.555 DEBUG: [ParsingError] C:/build_agent/1/s/APP/F28335/SPEPC003/DspLV/Build/BootloaderBased/../../../../../Middleware/Diagnostics\adf_core.h:111 named bit-field 'Result' has zero width
2023-12-06T15:25:29.5564432Z 09:25:29.555 DEBUG: [ParsingError] C:/build_agent/1/s/APP/F28335/SPEPC003/DspLV/Build/BootloaderBased/../../../../../Middleware/Diagnostics\adf_core.h:112 named bit-field 'ErrorCode' has zero width
2023-12-06T15:25:29.5565116Z 09:25:29.555 DEBUG: [ParsingError] C:/build_agent/1/s/APP/F28335/SPEPC003/DspLV/Build/BootloaderBased/../../../../../Middleware/Diagnostics\adf_core.h:121 named bit-field 'pbar' 

My project is building correctly and everything else looks okay.
What should be done to fix this problem?

Hi,

Your second log snipped asks you to provide the reproducer file. Are you comfortable doing that publicly?

 
Ann

I cannot, because of my companies policy. :frowning_face:
Is there another way to share it?

Hi @clima6, and thanks for sharing the reproducer with us.

It seems that you are using an old version of cl2000.exe compiler from Texas Instruments. Unfortunately, we don’t support this compiler at the moment, See CPP-2906.

Is it possible to build your code using a more recent version (or a different) compiler?

Another option is to use “Automatic Analysis for C and C++ projects” available on SonarCloud, in case this is a viable option for you.

Best regards,
Michael