Do not assume 0x0 to be an unusable address#628
Do not assume 0x0 to be an unusable address#628OlegHahm merged 1 commit intoRIOT-OS:masterfrom Kijewski:fno-delete-null-pointer-checks
Conversation
|
Wouldn't it make sense to add this flag in a CPU dependent Makefile then? |
|
Counter question: is there any CPU where you cannot access 0x0? |
|
I guess on most platforms without a MMU having a pointer to address 0x0 indicates a problem in 99% of all cases, but maybe I do not understand the change you propose. |
|
Reading from 0x0 might be seldom reasonable, true. |
|
Ok, after reading the GCC manpage, I think I see your point. ACK from my side. |
Do not assume 0x0 to be an unusable address
|
clang does not know this parameter....throws a warning for every unit it has to compile. |
|
Open an issue - nobody looks at merged/closed PRs/issues for problems to fix. |
I just ran into the problem that GCC assumes that a pointer cannot be NULL, if you have accessed it previously, e.g.
The problem is that 0x0 is a perfectly fine address to read from without an MMU / paging.
So it is completely unreasonable that the
if (!x)is dropped without any sort of warning.