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

Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> changed:

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

--- Comment #28 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #0)
> This is not valid if the evaluation depends on any content of the callee
> that is "unspecified" per the language standard(s). […]
> 
> This is wrong code because a different implementation can choose to evaluate
> the arguments in a different order, […]

I don't believe this optimization is not conforming.

Looking at https://eel.is/c++draft/defns.unspecified, "unspecified behavior"
means "behavior […] that depends on the implementation".

Or in this specific case we get "GCC depends on the behavior of GCC". I don't
see how the standard takes issue with that. Now, maybe we want to give the
additional guarantee that "GCC depends on the behavior that is equal among all
GCC-compatible compilers" (or something similar). But, do we really?

Reply via email to