Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362668 - Running C/C++ Code Analysis on a project containing an assembly file results in a NPE
Summary: Running C/C++ Code Analysis on a project containing an assembly file results ...
Status: CLOSED DUPLICATE of bug 431026
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-02 09:31 EDT by Richard Horbach CLA
Modified: 2014-07-10 21:59 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Horbach CLA 2011-11-02 09:31:16 EDT
When running C/C++ Code Analysis (RMB > Run C/C++ Code Analysis) on a project containing an assembly file, then a Null Pointer Exception is thrown.
Comment 1 Richard Horbach CLA 2011-11-02 09:32:56 EDT
Stack trace:

java.lang.NullPointerException
	at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(TranslationUnit.java:811)
	at org.eclipse.cdt.internal.core.model.TranslationUnit.getAST(TranslationUnit.java:768)
	at org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache.getAST(CxxModelsCache.java:73)
	at org.eclipse.cdt.codan.core.cxx.model.CxxModelsCache.getAST(CxxModelsCache.java:63)
	at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.processFile(AbstractIndexAstChecker.java:73)
	at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.processResource(AbstractIndexAstChecker.java:54)
	at org.eclipse.cdt.codan.core.model.AbstractChecker.processResource(AbstractChecker.java:248)
	at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:151)
	at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:97)
	at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:182)
	at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:109)
	at org.eclipse.cdt.codan.internal.ui.actions.RunCodeAnalysis$1.run(RunCodeAnalysis.java:56)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 2 Richard Horbach CLA 2011-11-02 09:36:13 EDT
n CoreModel.isValidTranslationUnit it is tested if a file is a translation unit. The test result depends on the contentType. Types cheader, csource, cxxheader, cxxsource and asmsource (org.eclipse.cdt.core.asmSource) are valid translation units according to this test.

In org.eclipse.cdt.internal.core.model.TranslationUnit, method getAST an ASTTranslationUnit is created from the file contents. For an assembly file this fails and returns null, resulting in the NPE. 

The bug is that C/C++ Code Analysis tries to process assembly files.
Comment 3 Jens Seidel CLA 2012-08-20 09:46:13 EDT
(In reply to comment #2)
> n CoreModel.isValidTranslationUnit it is tested if a file is a translation
> unit. The test result depends on the contentType. Types cheader, csource,
> cxxheader, cxxsource and asmsource (org.eclipse.cdt.core.asmSource) are
> valid translation units according to this test.

Photran (the Fortran frontend) uses also CDT and I got this bug also.

> The bug is that C/C++ Code Analysis tries to process assembly files.

And as it looks like Fortran files ...
Comment 4 Nathan Ridge CLA 2014-07-10 02:30:19 EDT
Looks like this issue was recently fixed in bug 431026.
Comment 5 Marc-André Laperle CLA 2014-07-10 21:59:54 EDT

*** This bug has been marked as a duplicate of bug 431026 ***