https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
Julius Werner <jwerner at chromium dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jwerner at chromium dot org --- Comment #32 from Julius Werner <jwerner at chromium dot org> --- I second Kees' request to please (permanently) add a flag to disable this inference and prevent GCC from making any assumptions about object sizes for pointers cast from integers. Ideally it should be a separate one-off flag rather than a level that needs to be set for a variety of individual warnings. This is affecting almost every systems programming project there is and going against 40 years of common C practice. The standard has never really specified a way to do MMIO hardware accesses, yet it's something we need to do in practice and casting integer literals to pointers is one of the main ways we do it. I don't think it's reasonable to suddenly start in 2022 to prosecute a "violation" that has been this prevalent for decades in programming practice. If you want to make these new safety checks available for those who want them that's fine, but please retain the option to stick with the existing behavior for those projects where this really causes a ton more problems than it could ever solve.