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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I see the issue:
        ListManager[probe].rchild = ListManager.Alloc();


If you take that, which side of the equals is evaluated first is the problem.
Is "ListManager[probe].rchild" or "ListManager.Alloc()".

GCC is evaluating the lhs side first and then rhs.
But ListManager.Alloc() has a side effect of doing a Array::resize() which
means the lhs has now a reference for the old array rather than the new one.


NOTE before C++17 is unspecified which side is evulated first.  I don't
remember the rules for C++17 to say if it is evulated the way you want it to be
evulated.

Reply via email to