Inline assembly that touches memory is not annotated ('memory-safe'), or violates the memory model. Under the via-IR pipeline the optimiser may reorder memory operations, producing subtly wrong results that pass simple tests.
// assembly { mstore(0x40, x) } writes the free-memory pointer region // without respecting allocation; under via-IR the optimiser assumes // memory-safety and mis-schedules, corrupting a later abi.encode.
assembly ("memory-safe") {
// only touch scratch space / properly allocated memory
}
Largest recorded losses in the same failure class — related, not the same bug:
The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0235 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.