|
|
Subscribe / Log in / New account

Signed overflow optimization hazards in the kernel

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 7:13 UTC (Thu) by stevenb (guest, #11536)
Parent article: Signed overflow optimization hazards in the kernel

Why not just use -fwrapv in the kernel?

`-fwrapv'
This option instructs the compiler to assume that signed arithmetic
overflow of addition, subtraction and multiplication wraps around
using twos-complement representation. This flag enables some
optimizations and disables others. This option is enabled by
default for the Java front-end, as required by the Java language
specification.


to post comments

Signed overflow optimization hazards in the kernel

Posted Aug 16, 2012 13:28 UTC (Thu) by PaulMcKenney (✭ supporter ✭, #9624) [Link]

Very cool, thank you for the info! Very welcome information, especially in light of the fact that the kernel compiles at -O2, not -O1 as I incorrectly stated. Apparently -fwrapv has also made its way into other compilers' command lines as well, including that of clang.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds