The scalability of distributed-memory systems makes them attractive for massively parallel computations. Howevcr, the issues of fault detection and fault tolerance are critical in such systems since the probability of having faulty components increases with the number of processors. We propose a methodology for fault detection on distributed-memory systems through compiler support. The single-program multiple-data (SPMD) execution model is extended to execute programs in which selecta data items are duplicated on different processors. During execution, whenever the values of duplicated data are computed, they are compared for the purpose of error detection. In other words, fault detection is controlled by the duplication of data. The proposed compiler-assisted fault-detection technique does not require any specialized hardware and attempts to exploit the idle capacity of the system whenever possible. After presenting the principles of duplicated computation through data duplication and the corresponding compiler algorithms, we focus on regular loops to exploit the idle processors for fault-detection purpose. We present experimental results that demonstrate the feasibility of the proposed approach.