This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 130510 - Stack overflow on parsing test constuctions
Summary: Stack overflow on parsing test constuctions
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-19 12:37 UTC by nnnnnk
Modified: 2013-05-07 11:21 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nnnnnk 2008-03-19 12:37:30 UTC
I got stack overflow on parsing following construction:

#define LBR1 ( ( ( ( ( ( ( ( ( (
#define LBR2 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1 LBR1
#define LBR3 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2 LBR2
#define LBR4 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3 LBR3
#define LBR5 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4 LBR4
#define LBR6 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5 LBR5

#define RBR1 ) ) ) ) ) ) ) ) ) )
#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1
#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2
#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3
#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4
#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5

int q5_var = LBR4 0 RBR4;

java.lang.StackOverflowError
        at antlr.ASTPair.<init>(ASTPair.java:15)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.relational_expression(CPPParser.java:17012)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.general_logical_expression(CPPParser.java:16911)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.conditional_expression(CPPParser.java:16840)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.assignment_expression(CPPParser.java:16043)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.expression(CPPParser.java:10114)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.cast_expression(CPPParser.java:17329)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.pm_expression(CPPParser.java:17227)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.multiplicative_expression(CPPParser.java:17158)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.additive_expression(CPPParser.java:17098)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.shift_expression(CPPParser.java:14779)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.relational_expression(CPPParser.java:17016)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.general_logical_expression(CPPParser.java:16911)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.conditional_expression(CPPParser.java:16840)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.assignment_expression(CPPParser.java:16043)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.expression(CPPParser.java:10114)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.cast_expression(CPPParser.java:17329)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.pm_expression(CPPParser.java:17227)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.multiplicative_expression(CPPParser.java:17158)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.additive_expression(CPPParser.java:17098)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.shift_expression(CPPParser.java:14779)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.relational_expression(CPPParser.java:17016)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.general_logical_expression(CPPParser.java:16911)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.conditional_expression(CPPParser.java:16840)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.assignment_expression(CPPParser.java:16043)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.expression(CPPParser.java:10114)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.cast_expression(CPPParser.java:17329)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.pm_expression(CPPParser.java:17227)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.multiplicative_expression(CPPParser.java:17158)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.additive_expression(CPPParser.java:17098)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.shift_expression(CPPParser.java:14779)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.relational_expression(CPPParser.java:17016)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.general_logical_expression(CPPParser.java:16911)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.conditional_expression(CPPParser.java:16840)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.assignment_expression(CPPParser.java:16043)
        at org.netbeans.modules.cnd.modelimpl.parser.generated.CPPParser.expression(CPPParser.java:10114)
        .................................................
Comment 1 nnnnnk 2008-04-01 16:53:41 UTC
Another examples:

#define LIM1(x) x##0: x##1: x##2: x##3: x##4: x##5: x##6: x##7: x##8: x##9: 
#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
                LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
                LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
                LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
                LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
                LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
                LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)

void q19_func (long i)
{
  switch (i) {
    LIM5 (case 1)
      break;
  }
}

----------------------------------------------------------------------------

#define PTR1 (* (* (* (* (* (* (* (* (* (*
#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1
#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2
#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3
#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4
#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5

#define RBR1 ) ) ) ) ) ) ) ) ) )
#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1
#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2
#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3
#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4
#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5

int PTR4 q4_var RBR4 = 0;

----------------------------------------------------------------------------

#define PTR1 * * * * * * * * * *
#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1
#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2
#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3
#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4
#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5

int PTR4 q3_var = 0;

----------------------------------------------------------------------------

#define LIM1(x) x##0 {x##1 {x##2 {x##3 {x##4 {x##5 {x##6 {x##7 {x##8 {x##9 {
#define LIM2(x) LIM1(x##0) LIM1(x##1) LIM1(x##2) LIM1(x##3) LIM1(x##4) \
                LIM1(x##5) LIM1(x##6) LIM1(x##7) LIM1(x##8) LIM1(x##9)
#define LIM3(x) LIM2(x##0) LIM2(x##1) LIM2(x##2) LIM2(x##3) LIM2(x##4) \
                LIM2(x##5) LIM2(x##6) LIM2(x##7) LIM2(x##8) LIM2(x##9)
#define LIM4(x) LIM3(x##0) LIM3(x##1) LIM3(x##2) LIM3(x##3) LIM3(x##4) \
                LIM3(x##5) LIM3(x##6) LIM3(x##7) LIM3(x##8) LIM3(x##9)
#define LIM5(x) LIM4(x##0) LIM4(x##1) LIM4(x##2) LIM4(x##3) LIM4(x##4) \
                LIM4(x##5) LIM4(x##6) LIM4(x##7) LIM4(x##8) LIM4(x##9)
#define LIM6(x) LIM5(x##0) LIM5(x##1) LIM5(x##2) LIM5(x##3) LIM5(x##4) \
                LIM5(x##5) LIM5(x##6) LIM5(x##7) LIM5(x##8) LIM5(x##9)
#define LIM7(x) LIM6(x##0) LIM6(x##1) LIM6(x##2) LIM6(x##3) LIM6(x##4) \
                LIM6(x##5) LIM6(x##6) LIM6(x##7) LIM6(x##8) LIM6(x##9)

#define RBR1 } x; } x; } x; } x; } x; } x; } x; } x; } x; } x;
#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1
#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2
#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3
#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4

LIM4(struct s)
  int x;
RBR4   
Comment 2 Vladimir Voskresensky 2008-11-21 10:46:59 UTC
is it still a reproducible problem?
Comment 3 Alexander Simon 2010-12-27 10:06:38 UTC
Yes, reproducible "another" examples.
Comment 4 nnnnnk 2010-12-28 12:54:56 UTC
http://hg.netbeans.org/cnd-main?cmd=changeset;node=7e5df925c242
partly fixed.

now we do not have visible assertions/exceptions.
but parser fails anyway, so code model is incomplete.