Memory-safe C code
Memory-safe C code
Posted Nov 16, 2025 6:52 UTC (Sun) by alx.manpages (subscriber, #145117)In reply to: Memory-safe C code by excors
Parent article: Rust in Android: move fast and fix things (Google Security Blog)
> C compilers don't do the proof
C compilers do more than that. At least if you use a long list of -Werror=... flags.
We need some more of those, I agree, but it does proof, to some extent. You need to opt in to those errors.
You can write C code where you know the compiler will prove you won't trigger most cases of UB.
I'm working specifically on a GCC patch with which you can write C functions where the compiler can prove you won't do any buffer overflows.
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
