A compiler, which receives a source program, translates said source program to provide an object program and then outputs said object program, comprising:
- translation means for translating a program;
- and
- stack protection instruction addition means for examining each sub-routine to determine whether a function included in said sub-routine has a data array, and for, when a data array is included, adding to said sub-routine an instruction for storing, before a function is executed, a guard variable between a previous frame pointer in a stack and a data array stored as a local variable in said stack, and for confirming the validity of said guard variable during a function return process.