Re: Compiling kernel with -std=gnu11

David Holland <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
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
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.