# \[$\] Reducing undefined behavior in the C language

DevFeed: [\[$\] Reducing undefined behavior in the C language](<https://devfeed.tech/articles/reducing-undefined-behavior-in-the-c-language-61380.md>)

Original publisher: [Read original article](<https://lwn.net/Articles/1095811/>)

Author: corbet

Published: 2026-09-28T15:16:22Z

Content type: article

Language: en

Sources: [LWN.net](<https://devfeed.tech/sources/lwn-net.md>)

Topics: [undefined\_behavior](<https://devfeed.tech/topics/undefined-behavior.md>), [Memory Safety](<https://devfeed.tech/topics/memory-safety.md>), [typesafety](<https://devfeed.tech/topics/typesafety.md>)

Tags: [2015](<https://devfeed.tech/tags/2015.md>), [2026](<https://devfeed.tech/tags/2026.md>), [abi](<https://devfeed.tech/tags/abi.md>), [abstract](<https://devfeed.tech/tags/abstract.md>), [annotations](<https://devfeed.tech/tags/annotations.md>), [architectures](<https://devfeed.tech/tags/architectures.md>), [array](<https://devfeed.tech/tags/array.md>), [behavior](<https://devfeed.tech/tags/behavior.md>), [buffer](<https://devfeed.tech/tags/buffer.md>), [buffer-overflow](<https://devfeed.tech/tags/buffer-overflow.md>), [bug](<https://devfeed.tech/tags/bug.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [c](<https://devfeed.tech/tags/c.md>), [c-language](<https://devfeed.tech/tags/c-language.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [language](<https://devfeed.tech/tags/language.md>), [linux](<https://devfeed.tech/tags/linux.md>), [memory](<https://devfeed.tech/tags/memory.md>), [talk](<https://devfeed.tech/tags/talk.md>), [undefined-behavior](<https://devfeed.tech/tags/undefined-behavior.md>)

## AI overview

C's undefined behavior gives implementations room for hardware support and optimization, but can leave programs without expected semantics and enable surprising compiler transformations. The article gives examples involving division by zero, observable side effects, and volatile stores, and notes that C23 added a "no time travel" rule for one such case. Mitigations include compiler warnings, static analysis, sanitizers, and formal verification; C2y's draft has removed 45 of roughly 100 instances of undefined behavior. Type and bounds safety can be improved with annotations, diagnostics, and checks, while temporal safety remains harder: Rust has an advantage, and CHERI and Fil-C can help. Full memory safety would require costly runtime checks or formal verification; the author expects the strongest near-term results from restricted C combined with formal methods.

## Source excerpt

As a professor of biomedical engineering, Martin Uecker perhaps does not fit the profile of a typical presenter at Kernel Recipes. He is, however, a longtime Linux user, and works on free software for controlling magnetic resonance imaging (MRI) scanners. He was at the conference to talk about the C programming language, the specific problem of undefined behavior in C, and whether it can eventually be made into a memory-safe language.