  Magic is a property of quantum states that enables universal fault-tolerant
quantum computing using simple sets of gate operations. Understanding the
mechanisms by which magic is created or destroyed is, therefore, a crucial step
towards efficient and practical fault-tolerant computation. We observe that a
random stabilizer code subject to coherent errors exhibits a phase transition
in magic, which we characterize through analytic, numeric and experimental
probes. Below a critical error rate, stabilizer syndrome measurements remove
the accumulated magic in the circuit, effectively protecting against coherent
errors; above the critical error rate syndrome measurements concentrate magic.
A better understanding of such rich behavior in the resource theory of magic
could shed more light on origins of quantum speedup and pave pathways for more
efficient magic state generation.
