A Static Approach for Detecting Concurrency Anomalies in Transactional Memory