News:

  • September 23, 2026, 01:20:12 PM

Login with username, password and session length

Author Topic: Math Stack Overflow  (Read 7815 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Math Stack Overflow
« on: February 21, 2022, 12:41:41 PM »
Well, this is the first time I've generated a stack overflow and watchdog timeout. It's clear where the issue is at (FOR Loop), I'm just trying to diagnose what the actual problem is. If I was trying to write to a memory location in the FOR Loop (say Array500) but I only had assigned memory (Array0-499), would this cause the stack overflow and watchdog timeout? 

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: Math Stack Overflow
« Reply #1 on: February 21, 2022, 01:12:26 PM »
Well, this is the first time I've generated a stack overflow and watchdog timeout. It's clear where the issue is at (FOR Loop), I'm just trying to diagnose what the actual problem is. If I was trying to write to a memory location in the FOR Loop (say Array500) but I only had assigned memory (Array0-499), would this cause the stack overflow and watchdog timeout?

Generally a math stack overflow is a bug in an instruction. A watchdog is easy to create. Anything over 200ms in a non-yielding task or program ($Main, for instance) is a watchdog. I'm wondering if the watchdog is real, but the math stack issue is secondary.

"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Math Stack Overflow
« Reply #2 on: February 22, 2022, 08:18:26 AM »
It looks like the Watchdog was primary and math stack overflow was secondary. I was running a loop in a subroutine to sort fault codes. This worked as intended until I had many faults at one time while debugging. I removed the loop and replaced it with a string copy range (which is what I should have done to start with) and it seems to have resolved the issue. 

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: Math Stack Overflow
« Reply #3 on: February 22, 2022, 09:58:18 AM »
It looks like the Watchdog was primary and math stack overflow was secondary. I was running a loop in a subroutine to sort fault codes. This worked as intended until I had many faults at one time while debugging. I removed the loop and replaced it with a string copy range (which is what I should have done to start with) and it seems to have resolved the issue.

Ah...loops in subroutines have some caveats. Several technical issues I won't bore you with, but that doesn't surprise me.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO