This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/79373] For loop optimization bug: condition ignored
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 05 Feb 2017 10:05:53 +0000
- Subject: [Bug c++/79373] For loop optimization bug: condition ignored
- Auto-submitted: auto-generated
- References: <bug-79373-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79373
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu.org
--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> I do understand that this is what happens (the code is fixed by promoting
> int32_t t=x to int64_t t=x) but the undefined behavior affects a variable
> (and its associated comparison) that should not be affected by it.
No, undefined behavior is not a bounded error in C or C++, which means that the
compiler doesn't have to control it; in other words, once it is reached at run
time, the entire program can be wrecked. Other languages, e.g. Ada, have a
notion of bounded error, which means the the compiler must control it somehow.