Mutating with `foldl` undefined behaviour?

This is what I meant. I encountered a strange issue recently through a definition of

append!(x, y) = foldl(push!, x, y)

for a custom data structure; the issue went away after I replaced the foldl with an explicit loop. I asked this question to help diagnose the problem.