Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368446 - Recursion error causes stack overflow when class inherits itself.
Summary: Recursion error causes stack overflow when class inherits itself.
Status: VERIFIED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.0.2   Edit
Assignee: Marc-André Laperle CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
: 366680 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-12 08:03 EST by Krister Renaud CLA
Modified: 2012-02-29 13:21 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Krister Renaud CLA 2012-01-12 08:03:27 EST
Build Identifier: M20110909-1335

When writing the following C++ code by mistake I get a stack overflow:

// Start code
class MyClass : public MyClass
{
}; 
// End code


!SESSION 2012-01-12 13:36:11.971 -----------------------------------------------
eclipse.buildId=M20110909-1335
java.version=1.6.0_29
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=sv_SE
Framework arguments:  -product org.eclipse.epp.package.cpp.product -keyring /Users/khr/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.cpp.product -keyring /Users/khr/.eclipse_keyring -showlocation

This is a continuation of log file /Users/khr/hg/test/.metadata/.bak_0.log
Created Time: 2012-01-12 13:47:07.669

!ENTRY org.eclipse.cdt.codan.core 4 1 2012-01-12 13:47:07.669
!MESSAGE Internal Error
!STACK 0
java.lang.StackOverflowError
	at org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper.getDeclaredMethods(ClassTypeHelper.java:325)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType.getDeclaredMethods(CPPClassType.java:368)
	at org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructor.getDestructor(NonVirtualDestructor.java:43)
	at org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructor.hasVirtualDestructor(NonVirtualDestructor.java:52)
	at org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructor.hasVirtualDestructor(NonVirtualDestructor.java:60)
	at org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructor.hasVirtualDestructor(NonVirtualDestructo

Reproducible: Always

Steps to Reproduce:
1. Enter the following code:

// Start code
// Code below should have been class MyClass : public MyClassBase

class MyClass : public MyClass 
{
}; 
// End code


2. Press <Apple>-S
Comment 1 Marc-André Laperle CLA 2012-01-14 16:56:18 EST
Fixed in 8.0.2 and master > 2012-01-14.
Comment 2 Marc-André Laperle CLA 2012-01-21 23:26:23 EST
Verified in 8.0.2 RC1.
Comment 3 Marc-André Laperle CLA 2012-02-10 00:37:28 EST
*** Bug 366680 has been marked as a duplicate of this bug. ***
Comment 4 CDT Genie CLA 2012-02-29 13:21:19 EST
*** cdt git genie on behalf of Marc-Andre Laperle ***

    Bug 368446 - NonVirtualDestructor checker: stack overflow when class
    inherits itself

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d98768295b4ad9f212dfd55c84b53ae9a2cab4ca
Comment 5 CDT Genie CLA 2012-02-29 13:21:21 EST
*** cdt git genie on behalf of Marc-Andre Laperle ***

    Bug 368446 - NonVirtualDestructor checker: stack overflow when class
    inherits itself

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