Fix Access Violation Error in x64 Assembly MASM Procedure for Complex Number Square Root Calculation

Here is a numerical simulation application for a job I'm engaged in that involves complex number calculations on Intel Core i7-12700K processor. As part of this simulation, I wrote a procedure in x64 assembly MASM to calculate the square root of a complex number. As I execute the procedure, I encounter an access violation error at the ret statement:
Exception thrown at 0x00007FF69997AA5C in HW04_Q01.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF
Exception thrown at 0x00007FF69997AA5C in HW04_Q01.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF
Right now I suspect the issue might be related to stack corruption, or improper use of the ret instruction, Please I need help in identifying the root cause of the access violation and correcting the code.
attachment 0
1 Reply
Marvee Amasi
Marvee Amasi4mo ago
i replaced each call to sqrt() C function with the mnemonic sqrtsd since the values i am dealing with are all stored in SSE registers xmm0 , xmm1 , xmm2 , ... and it worked
Want results from more Discord servers?
Add your server