[Bug c/82296] Warn for code removal due to "code never accesses array out of bounds" assumption

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 22 13:53:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82296

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Ingo from comment #3)
> And just because there is this paragraph in the C language specification,
> the compiler is then allowed to produce "random" code ?

Yes. The compiler assumes that undefined behavior is never invoked
and optimizes accordingly. This is nothing new.
If you need hand-holding use the sanitizers.


More information about the Gcc-bugs mailing list