This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Stack corruption

Hello,

I am working on AT91SAM9G20, Keil 5.10. I am passing a constant structure pointer
to a function.

typedef struct
{
   int Test;
   int OkFlag;
}StructNode;

typedef const StructNode *const Node_t

after passing the node 3 times recursively through a function

stack data is getting corrupted.

Am I doing any mistake, Please suggest.

Parents
  • I have abundant stack,
    I am not modifying any data inside the function, I have trimmed
    the function to minimal, for just passing a duplicate node
    but data variables present in the first caller are getting corrupted.

    I am type casting a auto variable to const type

    
    StructNode Node;
    Node_t NodePtr = &Node;
    
    

    I suspect there might be issue with Node_t typecast from Node

Reply
  • I have abundant stack,
    I am not modifying any data inside the function, I have trimmed
    the function to minimal, for just passing a duplicate node
    but data variables present in the first caller are getting corrupted.

    I am type casting a auto variable to const type

    
    StructNode Node;
    Node_t NodePtr = &Node;
    
    

    I suspect there might be issue with Node_t typecast from Node

Children