Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352983

Summary: internal error in switch isFallThroughStatement
Product: [Tools] CDT Reporter: Matthias Hilbig <mhilbig>
Component: cdt-codanAssignee: Marc-André Laperle <malaperle>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, malaperle
Version: 8.0   
Target Milestone: 8.0.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Internal error isFallThroughStatement patch malaperle: iplog-

Description Matthias Hilbig CLA 2011-07-25 05:27:05 EDT
Build Identifier: 

typing:

 switch(i) {
  case 0:
    break;
  case 1:
    break;
  default: {
    //asdf
  }
  }

leads to the following internal error:

eclipse.buildId=I20110613-1736
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.cpp.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.cpp.product

Error
Mon Jul 25 11:19:51 CEST 2011
Internal Error

java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker$SwitchFindingVisitor.isFallThroughStamement(CaseBreakChecker.java:142)
	at org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker$SwitchFindingVisitor.visit(CaseBreakChecker.java:102)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSwitchStatement.accept(CPPASTSwitchStatement.java:95)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompoundStatement.accept(CPPASTCompoundStatement.java:79)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDefinition.accept(CPPASTFunctionDefinition.java:187)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNamespaceDefinition.accept(CPPASTNamespaceDefinition.java:129)
	at org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit.accept(ASTTranslationUnit.java:279)
	at org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker.processAst(CaseBreakChecker.java:214)
	at org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker.processModel(AbstractIndexAstChecker.java:103)
	at org.eclipse.cdt.codan.internal.core.CodanBuilder.processResource(CodanBuilder.java:149)
	at org.eclipse.cdt.codan.internal.core.CodanBuilder.runInEditor(CodanBuilder.java:218)
	at org.eclipse.cdt.codan.core.cxx.internal.model.CxxCodanReconciler.reconciledAst(CxxCodanReconciler.java:38)
	at org.eclipse.cdt.codan.internal.ui.cxx.CodanCReconciler.reconciled(CodanCReconciler.java:81)
	at org.eclipse.cdt.internal.ui.editor.CEditor.reconciled(CEditor.java:3145)
	at org.eclipse.cdt.internal.ui.text.CReconcilingStrategy.reconcile(CReconcilingStrategy.java:108)
	at org.eclipse.cdt.internal.ui.text.CReconcilingStrategy.reconcile(CReconcilingStrategy.java:73)
	at org.eclipse.cdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:84)
	at org.eclipse.cdt.internal.ui.text.CCompositeReconcilingStrategy.reconcile(CCompositeReconcilingStrategy.java:90)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
	at org.eclipse.cdt.internal.ui.text.CReconciler.process(CReconciler.java:408)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)


 

Reproducible: Always
Comment 1 Marc-André Laperle CLA 2011-07-25 14:04:30 EDT
Created attachment 200298 [details]
Internal error isFallThroughStatement patch
Comment 2 Marc-André Laperle CLA 2011-07-25 14:05:15 EDT
Thank you for reporting the bug. Fixed in 8.0.1 and master > 20110725.
Comment 3 CDT Genie CLA 2011-07-25 14:18:47 EDT
*** cdt git genie on behalf of 352983 ***

    Bug 352983 - internal error in switch isFallThroughStatement

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=74ecb38ea31e7ac24a73f060477ade5300f04aa8
Comment 4 CDT Genie CLA 2011-07-25 14:18:50 EDT
*** cdt git genie on behalf of 352983 ***

    Bug 352983 - internal error in switch isFallThroughStatement

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=fe6f2ae68f807c253d257dcb5906d2806f6b9673