Patent ID: 8020152

Claim:
A method, implemented within a computer system that includes one or more processors, for generating one or more test cases for testing for defects or bugs in a compiler, by benignly morphing syntax and/or structure of code having a known compilation result to generate morphed code that is syntactically different from the code, but which has the same semantic context of the code, and by comparing a result of compiling the morphed code with the compiler with the known compilation result, the method comprising: an act of a computer system, which includes one or more processors, receiving code from a data source, wherein a first compilation result of compiling the received code is known; an act of the computer system determining syntactical characteristics and construct properties of the received code in order to determine one or more portions of the received code which are to be benignly morphed in one or more of syntax or structure; an act of the computer system benignly morphing the received code as a result of the determination of the syntactical characteristics and construct properties of the received code, wherein benignly morphing the received code includes injecting at least one selected morph to the one or more determined portions of the received code, wherein the at least one selected morph is at least one of expanding a width of a primitive type, superfluously using an external variable, replacing a method with a constant or converting locals into another storage space, and wherein the selected morph changes one or more of syntax or structure of the received code while preserving the same semantic context of the received code; an act of the computer system compiling the benignly morphed code using the compiler to generate a second compilation result; and an act of the computer system testing for defects or bugs in the compiler by comparing the known first compilation result against the second compilation result, wherein when the first compilation result is different from the second compilation result it is determined that the compiler has at least one defect or bug relative to compiling the at least one selected morph.