A static approach for detecting concurrency anomalies in transactional memory