This issue tracker is closed. Please visit UPPAAL issue tracker at Github instead.

Bug 642

Summary: memory exhausted on too many if-then-else nested statements
Product: UPPAAL Reporter: Marius Mikučionis <marius>
Component: libutapAssignee: Marius Mikučionis <marius>
Status: RESOLVED FIXED    
Severity: normal CC: adavid
Priority: P5    
Version: 4.1.20   
Hardware: All   
OS: All   
Architecture:

Description Marius Mikučionis 2017-08-29 13:34:01 CEST
The following code triggers the "memory exhausted" error/crash in the parser:

int a;
int i;

void calc() {
  if (i == 1) a = 0;
  else if (i == 2) a = 0;
  else if (i == 3) a = 0;
  else if (i == 4) a = 1;
  else if (i == 5) a = 1;
  else if (i == 6) a = 1;
  else if (i == 7) a = 1;
  else if (i == 8) a = 1;
  else if (i == 9) a = 1;
  else if (i == 10) a = 1;
  else if (i == 11) a = 1;
  else if (i == 12) a = 1;
  else if (i == 13) a = 1;
  else if (i == 14) a = 1;
  else if (i == 15) a = 1;
  else if (i == 16) a = 2;
  else if (i == 17) a = 2;
  else if (i == 18) a = 3;
  else if (i == 19) a = 3;
  else if (i == 20) a = 3;
  else if (i == 21) a = 4;
  else if (i == 22) a = 4;
  else if (i == 23) a = 4;
  else if (i == 24) a = 4;
  else if (i == 25) a = 4;
  else if (i == 26) a = 4;
  else if (i == 27) a = 4;
}

The error is indicated around "i==24", which hits the stack limit bison allocates for right-recursive rules.

The solution is probably to rewrite the if-then-else rules to use left recursion (which consumes almost no stack).
Comment 1 Marius Mikučionis 2018-06-25 11:55:58 CEST
fixed in uppaal branch