This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/79373] For loop optimization bug: condition ignored


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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Steven Pigeon from comment #7)
> 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.

The C++ standards defines undefined behavior as "behavior for which this
International Standard imposes no requirements". No requirements. Not "doesn't
affect things that you think shouldn't be affected". All bets are off.

There is no requirement for a compiler to do something you find unsurprising,
or to limit the scope of the bug to parts of the code you expect to misbehave.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]