-
Hi Stephan, I have encountered a strange issue with a particular C program that sometimes causes the trap handler to be triggered when a particular load word So to explain, I have made some modifications to Neorv32 to achieve fault injection into the program counter and when I run this problematic C code that is shown below, by monitoring the program counter The Neorv32 version used was taken from Github on 23/09/2023 and the instruction that causes the trigger is at address This is the C code in mention. it is an insertion sorting algorithm that sorts the data array:
Here is the assembly file (note, the issue occurs from the lw instruction at address
Here is an image showing the first time the lw instruction is executed at |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @DS-567! I just tested your program and I also get several load access exceptions. I think this is just a coding issue. Your insertion function seems to be accessing an element that is out of bounds. If have changed this line while (tmp < arr[j] && j >= 0) { to while (tmp < arr[j] && j > 0) { (according to https://en.wikipedia.org/wiki/Insertion_sort). By this, |
Beta Was this translation helpful? Give feedback.
Hey @DS-567!
I just tested your program and I also get several load access exceptions. I think this is just a coding issue. Your insertion function seems to be accessing an element that is out of bounds.
If have changed this line
to
(according to https://en.wikipedia.org/wiki/Insertion_sort). By this,
j
cannot get negative inside the while-loop and the program happily executes without any exceptions - but I did not check the actual processing result.