tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NULL pointer arithmetic issues
>> The correct fix is not to disable the null-pointer-check option but
>> to remove the broken automatic non-null arguments in GCC.
> The C standard and current usage (GNU) disagrees here.
GNU is not some kind of arbiter of "current usage" (whatever _that_
means).
> memcpy (along with a number of other functions) must not accept NULL
> arguments and compiler can optimize the code based on these
> assumptions.
Then such functions - or the language in which they are embedded - is
not suitable for writing kernels.
But, is it "must not accept null arguments" or is it "may do anything
they like when presented with null arguments"? Given the lack of any
way for it to "not accept" arguments, I suspect it is the latter, in
which case it is not the language but rather the compiler, the compiler
that mis-"optimizes" those cases into broken code, that is not suitable
for kernel use.
The "automatic non-null arguments" are not apporpriate in a language
used for writing kernels. Whether that means changing the basic
language, changing compilers, changing compiler flags, changing a file
somewhere, I don't know. But the answer is to fix the problem, not to
twist the code into a pretzel to work around the compiler's refusal to
be suitable for the job.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index