Compiler Optimization Bug

Hello,

I think I’ve found a bug with the compiler optimization option “Eliminate unnecessary arithmetic.” It appears to be eliminating my else statement, which is not unnecessary arithmetic.

The compiler is removing line https://github.com/Octogonapus/BCI/blob/development/Modules/Heap/heap.c#L38

I have tested this by running my program with and without this optimization option, and the results of each test are different. The program works correctly without this flag, and incorrectly with this flag.

Ok, I will have a look at this.

Edit: Ok, so I can confirm the bug exists, there’s really no need to use those compiler options so I suggest you just leave them on the default settings.

I do notice some bugs in the code you are using. malloc returns an index at the end of the allocated space, when free is called it clears the wrong area (Unless I just mis-understand how to use the library ).