[LLVMbugs] [Bug 17318] Assigning to std::vector element with simultaneous reallocation of this vector

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 21 14:30:33 PDT 2013


Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
(In reply to comment #0)
> Hi! I've noticed, that if you assign value to item of std::vector, the left
> part takes address of item before evaluating right part, so in case if you
> have resized vector in right part for example in function, assigning will be
> done to deleted item (because it was deleted during resize). It differs from
> g++ behavior, so some "correct g++ code" can crash. Is this bug or feature,
> or my code isn't correct in this case?

Your code is incorrect. The operands of an assignment (or in this case, a
function call -- to an assignment operator) are not evaluated in any particular
sequence, and a compiler can evaluate them in any order it likes (or even
interleave the evaluation, subject to a few restrictions).

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130921/877e66df/attachment.html>

More information about the llvm-bugs mailing list