|
|
Log in / Subscribe / Register

No only somewhat different

No only somewhat different

Posted Nov 16, 2024 0:05 UTC (Sat) by SLi (subscriber, #53131)
Parent article: Progress on toolchain security features

> Nick Alcock said that access is not currently used to generate warnings for exceeding the bounds, however; it is, instead, "a promise to the optimizer" that the bounds will not be exceeded, which is somewhat different.

That doesn't sound like "somewhat different", but the exact opposite. The first asks the compiler to check; the second makes a promise to a compiler, allowing it to silently do rubbish if the promise doesn't hold. The first one turns (some) erroneous or undefined behavior into a warning. The second one turns correct-at-the-language-level behavior into UB.

The first one is good for diagnostics and checking. The second one is the opposite; it is good for optimization when you know something cannot happen and want the compiler to use that information as much as it can.


to post comments


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