@dalias@pervognsen@regehr i think you might need to start a small war with clang, gcc and msvc developers if you want to argue that line of thought :')
@pervognsen@regehr Only because you dereferenced it without checking the return value, so the case where it failed has UB and can be assumed not to happen.
For small n where the "as-if" allocation can surely happen on the stack, you could also assume it doesn't fail *if* you make the transformation not to really call malloc. But in general, you can't do that.
@dalias@pervognsen@regehr even if you check the return value it can elide it (it's also irrelevant how large the allocation is, you can bloat it to allocate an extremely large amount of memory and it'll still elide the whole thing) https://gcc.godbolt.org/z/doEfnac61