All challenges
Code AnalysisBeginner 60s

DCLP Missing Release Ordering

Find the bug.
Starter code
static std::atomic<Widget*> inst{nullptr};
Widget* get(){
  Widget* p = inst.load(std::memory_order_relaxed);
  if(!p){
    std::lock_guard g(mtx);
    p = inst.load(std::memory_order_relaxed);
    if(!p){ p = new Widget(); inst.store(p, std::memory_order_relaxed); }
  }
  return p;
}

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle