tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Compiling kernel with -std=gnu11



On Sun, Jan 05, 2025 at 08:45:44PM +0100, Anders Magnusson wrote:
 > > Under -std=c11, this rounds the product to float precision first, and
 > > then computes the sum, as required by the C spec.  Under -std=gnu11,
 > > this may compute everything in double or extended precision, just like
 > > if it had been `return x*y + c' with no intermediate `float' variable
 > > assignment.  (The finer-grained option here is -fexcess-precision:
 > > under -std=c11 it's set to `standard'; under -std=gnu11, to `fast'.)
 >
 > Hm, interesting optimization.? I understand why they have done this,
 > but I would not have expected it to be the default behaviour.
 > Writing code like this is not uncommon to get rounding as expected.

These are the people who came up with -ffast-math.

Anyway, I object to C11 without explicitly disabling the memory model
stuff, unless we are VERY VERY SURE it isn't going to make half the
kernel into UB. Which I don't think we can be.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index