Thread migration/checkpointing is becoming indispensable for load balancing and fault tolerance in high performance computing applications, and its success depends on the migration/checkpointingsafety, which concerns the construction of an accurate computation state. This safety is hard to guard in some languages, such as the C, whose type-unsafe features may cause the dynamic types associated with memory segments to be totally different from the static types declared in programs. To overcome this, we propose a novel intra-procedural, flowinsensitive, and context-insensitive pointer inference algorithm to systematically detect and recover unsafe factors. The proposed scheme conducts a thorough static analysis at compile time and inserts a minimized set of primitives to reduce the overhead of possible dynamic checks at run-time. Consequently, most unsafe features will be removed. Programmers can then code in any style, and nearly every program will be qualified for migration/checkpoi...