Cortex M4 hard fault finding root cause on LPC4078

well, ok. Now we are talking taste though about which there is nothing to debate…

I personally don’t like the idea of burning cycles for no other reason than gaining a little bit more error checking (even only in a debug scenario; if you activate this via #ifdef DEBUGVERSION, you gain differing runtime behavior which has its own problems). It potentially bloats the code significantly, sometimes very unintuitively - consider the code

void SomeFn(unsigned long p_Size)
{
    unsigned char[p_Size] = {0};
    ....
}

If you compile that for, say, an ARM Cortex, it may inline the function and generate unfolded code when the compiler can determine the size at compile time. You’d be surprised how much more footprint (-Ot) or execution time (-Os) that can cause , factually changing the runtime behavior…

Also, can you think of a technique to catch the following?

void SomeFn(void)
{
    CustomCppObject l_TempObject;
    ...
}

Yet again, this is leading off the original issue, and it’s about coding technique preferences where there is no ultimate good or bad.