Detecting data races on weak memory systems