JP5908374B2 - Compiler evaluation apparatus, method, and program - Google Patents
Compiler evaluation apparatus, method, and program Download PDFInfo
- Publication number
- JP5908374B2 JP5908374B2 JP2012188008A JP2012188008A JP5908374B2 JP 5908374 B2 JP5908374 B2 JP 5908374B2 JP 2012188008 A JP2012188008 A JP 2012188008A JP 2012188008 A JP2012188008 A JP 2012188008A JP 5908374 B2 JP5908374 B2 JP 5908374B2
- Authority
- JP
- Japan
- Prior art keywords
- execution
- program
- test data
- source program
- range
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000011156 evaluation Methods 0.000 title claims description 24
- 238000000034 method Methods 0.000 title claims description 16
- 238000012360 testing method Methods 0.000 claims description 84
- 230000006870 function Effects 0.000 claims description 23
- 238000010586 diagram Methods 0.000 description 7
- 239000000284 extract Substances 0.000 description 4
- 238000012423 maintenance Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Description
本発明は、ソースプログラムを実行プログラムにコンパイルするコンパイラの評価技術に関する。 The present invention relates to a compiler evaluation technique for compiling a source program into an execution program.
プログラミング言語で記述されたソースプログラムは、内容が完全に一致した状態で、ターゲットマシンに直接理解される実行プログラムにコンパイルされることが望まれる。
ソースプログラムと、このソースプログラムからコンパイルされた実行プログラムとの一致又は不一致は、例えば次のようにして確認することができる。
It is desirable that a source program written in a programming language be compiled into an execution program that can be directly understood by the target machine, with the contents completely matched.
The match or mismatch between the source program and the execution program compiled from the source program can be confirmed as follows, for example.
つまり、ソースプログラムのコンパイラを複数用意し、互いに異なる動作環境で動作する複数の実行プログラムを生成する。そして、生成された複数の実行プログラムに対し、同一の入力値を与え、得られた出力値のそれぞれを比較することによって、コンパイラのバグを間接的に検出することができる。
この2種類のコンパイラにおいて、共通の箇所に同じバグが存在する可能性は極めて低い。このため、出力結果に不一致が存在すれば、いずれか一方のコンパイラにバグの存在が推定される(例えば、特許文献1,2)。
That is, a plurality of source program compilers are prepared, and a plurality of execution programs that operate in different operating environments are generated. Then, it is possible to indirectly detect a compiler bug by giving the same input value to a plurality of generated execution programs and comparing the obtained output values.
In these two types of compilers, it is very unlikely that the same bug exists at a common location. For this reason, if there is a discrepancy in the output results, the presence of a bug in one of the compilers is estimated (for example,
上述したソースプログラムと実行プログラムとの一致・不一致の確認作業は、バグ位置が不一致であることが期待される、製造元の異なる2種類のコンパイラが必要となる。
しかし、CPUによっては、このように2種類のコンパイラを入手することが困難な場合があり、この場合は、ソースプログラムと実行プログラムの一致・不一致を確認することが不可能である。
The above-described confirmation work of matching / mismatching between the source program and the execution program requires two types of compilers from different manufacturers that are expected to have mismatched bug positions.
However, depending on the CPU, it may be difficult to obtain two types of compilers in this way. In this case, it is impossible to confirm the match / mismatch between the source program and the execution program.
本発明はこのような事情を考慮してなされたもので、単独のコンパイラで、ソースプログラムと実行プログラムとの一致・不一致を確認することができるコンパイラ評価技術を提供することを目的とする。 The present invention has been made in consideration of such circumstances, and an object of the present invention is to provide a compiler evaluation technique capable of confirming the match / mismatch between a source program and an execution program with a single compiler.
コンパイラ評価装置において、プログラミング言語で記述されたソースプログラムを保持する第1保持部と、前記ソースプログラムをプロセッサで実行できるようにコンパイルした実行プログラムを保持する第2保持部と、前記ソースプログラム及び前記実行プログラムの少なくとも一方に基づいてテストデータを生成するテストデータ生成部と、前記テストデータを保持し前記実行プログラムの実行手段に送出する第3保持部と、前記テストデータを入力し前記ソースプログラムを実行するインタープリタと、前記実行プログラムの実行手段の実行結果及び前記インタープリタの実行結果を対比して一致するか否かを判定する判定部と、前記ソースプログラムを構成する関数の内部範囲を設定するとともにこの内部範囲に対応する前記実行プログラムの比較範囲を設定する範囲設定部と、を備え、前記テストデータ生成部は、前記ソースプログラムの内部範囲及び前記実行プログラムの比較範囲の少なくとも一方に基づいてテストデータを生成することを特徴とする。 In the compiler evaluation apparatus, a first holding unit for holding a source program described in a programming language, a second holding unit for holding an execution program compiled so that the source program can be executed by a processor, the source program, and the A test data generation unit that generates test data based on at least one of the execution programs, a third holding unit that holds the test data and sends the test data to the execution unit of the execution program, and inputs the test data to the source program The interpreter to be executed, the determination unit for determining whether or not the execution result of the execution unit of the execution program and the execution result of the interpreter match and set, and the internal range of the functions constituting the source program are set Said execution corresponding to this internal range It includes a range setting unit that sets a comparison range of programs, and the test data generating unit, and characterized by generating the test data based on at least one of the comparison range of the internal scope and the execution program of said source program To do.
本発明により、単独のコンパイラで、ソースプログラムと実行プログラムとの一致・不一致を確認することができるコンパイラ評価技術が提供される。 According to the present invention, there is provided a compiler evaluation technique capable of confirming a match / mismatch between a source program and an execution program with a single compiler.
(第1実施形態)
以下、本発明の実施形態を添付図面に基づいて説明する。
図1に示すように第1実施形態に係るコンパイラ評価装置10は、プログラミング言語で記述されたソースプログラムを保持する第1保持部11と、このソースプログラムをプロセッサで実行できるようにコンパイルした実行プログラムを保持する第2保持部12と、このソースプログラム及び実行プログラムの少なくとも一方に基づいてテストデータを生成するテストデータ生成部15と、このテストデータを保持し実行プログラムの実行手段(ターゲットCPU21)に送出する第3保持部13と、テストデータを入力しソースプログラムを実行するインタープリタ17と、実行プログラムの実行手段(ターゲットCPU21)の実行結果及びインタープリタ17の実行結果を対比して一致するか否かを判定する判定部18とを、備えている。
(First embodiment)
Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings.
As shown in FIG. 1, a
第1保持部11は、プログラミング言語で記述されたソースプログラムを外部入力し保持するものである。
図2は、ソースプログラムを構成する関数の一例を示し、図3はこの図2に示すソースプログラムの関数に対応する実行プログラムを示している。
The
FIG. 2 shows an example of a function constituting the source program, and FIG. 3 shows an execution program corresponding to the function of the source program shown in FIG.
ソースプログラムは、プログラマが読み書きすることを前提に作成されたもので、一連の処理を実行する関数を単位として、複数の関数が羅列して構成されている。
そして、関数は、if, while, do-while, for, switch等で定義されるプログラムパスの組み合わせからなり、入力変数を受け取って、実行結果を引き渡す。
The source program is created on the assumption that the programmer reads and writes, and is configured by arranging a plurality of functions in units of functions that execute a series of processes.
The function is a combination of program paths defined by if, while, do-while, for, switch, etc., receives an input variable, and delivers an execution result.
コンパイラ14は、第1保持部11からソースプログラムを取得して、プロセッサ(ターゲットCPU21)において実行可能な実行プログラムにコンパイルするものである。
プロセッサは、ソースプログラムを直接理解することができないために、図3で示されるようなバイナリコードで表される実行プログラムにより処理がなされる。
The
Since the processor cannot directly understand the source program, processing is performed by an execution program represented by binary code as shown in FIG.
第1実施形態におけるテストデータ生成部15は、ソースプログラムを構成する関数(図2)を単位として抽出された入力変数(int a, int b)の組み合わせに基づくテストデータ(図5)を生成するものである。
そして、生成されたテストデータ(図5)は、第3保持部13に保持される。
The test
Then, the generated test data (FIG. 5) is held in the
図4のフローチャートに基づいて第1実施形態におけるテストデータ生成部15のアルゴリズムを説明する(適宜、図1,図2参照)。
テストデータ生成部15は、第1保持部11からソースプログラムを読み込み(S11)、ソースプログラムの入力変数(int a, int b)を抽出する(S12)。
The algorithm of the test
The test
そして、第2保持部12から実行プログラムを読み込み(S13)、実行プログラムの入力変数(R1,R2)を抽出する(S14)。 Then, the execution program is read from the second holding unit 12 (S13), and the input variables (R1, R2) of the execution program are extracted (S14).
図24(A)は、実行プログラムから入力変数を抽出するアルゴリズムを示す図である。図24(A)に示すように、実行プログラムを逆アセンブルし、ソースプログラムと実行プログラムを比較して、ソースプログラムの入力変数に対応する実行プログラムの入力変数を決定する。 FIG. 24A is a diagram showing an algorithm for extracting input variables from the execution program. As shown in FIG. 24A, the execution program is disassembled, the source program and the execution program are compared, and the input variable of the execution program corresponding to the input variable of the source program is determined.
図24(B)は、実行プログラムから入力変数を抽出する例を示す図である。図24(B)の例のように、"c = 0"に対応するアセンブラは"LDI R10,0"でありcとR10が対応し、"a++"に対応するアセンブラは"ADDI R1,R1,1"でありaとR1が対応し、"while(a < b)"に対応するアセンブラは"CMP R1,R2"でありbとR2が対応することを決定する。 FIG. 24B is a diagram illustrating an example of extracting input variables from the execution program. As in the example of FIG. 24B, the assembler corresponding to “c = 0” is “LDI R10,0”, c and R10 are corresponding, and the assembler corresponding to “a ++” is “ADDI R1, R1,” The assembler corresponding to “while (a <b)” is “CMP R1, R2”, and b and R2 are determined to correspond to “while (a <b)”.
さらに、図5に示すように、テストデータ生成部15は、入力変数の全ての組み合わせについて、テストデータ出力する(S15)。
Furthermore, as shown in FIG. 5, the test
変数aおよびbが8ビットの場合、変数a、bの値の範囲は、-128〜+127であるので、入力変数の全ての組合せは、
(a,b) : (-128,-128) , (-128,-127), ... , (+127,+127)
となる。テストデータは、2の16乗通り必要である。
When variables a and b are 8 bits, the range of values of variables a and b is -128 to +127, so all combinations of input variables are
(a, b): (-128, -128), (-128, -127), ..., (+ 127, + 127)
It becomes. The test data is required to be 2 to the 16th power.
変数aおよびbが16ビットの場合、変数a、bの値の範囲は、-32768〜+32767であるので、入力変数の全ての組合せは、
(a,b) : (-32768,-32768) , (-32768,-32767), ... , (+32767,+32767)
となる。テストデータは2の32乗通り必要である。
If the variables a and b are 16 bits, the range of values of the variables a and b is -32768 to +32767, so all combinations of input variables are
(a, b): (-32768, -32768), (-32768, -32767), ..., (+ 32767, + 32767)
It becomes. The test data is required to be 2 to the 32nd power.
このテストデータの生成は、上述の方法でソースプログラムおよび実行プログラムから抽出した入力変数のいずれか一方に基づいて生成することができる。
なお、図5において、多数あるテストデータがのうち一部を示している。
The test data can be generated based on one of the input variables extracted from the source program and the execution program by the method described above.
In FIG. 5, a part of the large number of test data is shown.
第3保持部13は、保持しているテストデータをインタープリタ17及び実行プログラムの実行手段(ターゲットCPU21)に送出する。
第1実施形態における実行プログラムの実行手段(ターゲットCPU21)は外部機器20に設けられている。
このために、第1実施形態のコンパイラ評価装置10は、外部機器20に接続して、ソースプログラム及び実行プログラムの一致・不一致を判定する。
The
Execution means (target CPU 21) of the execution program in the first embodiment is provided in the
For this purpose, the
ターゲットCPU21は、第2保持部12から実行プログラムを取得し、第3保持部13から入力変数の組み合わせの異なる複数のテストデータを入力して実行する。そして、ターゲットCPU21は、この実行結果を判定部18に出力する。
インタープリタ17は、第1保持部11からソースプログラムを取得し、第3保持部13から入力変数の組み合わせの異なる複数のテストデータを入力して実行する。そして、インタープリタ17は、この実行結果を判定部18に出力する。
The
The
図6のフローチャートに基づいてインタープリタ17のアルゴリズムを説明する(適宜、図1参照)。
インタープリタ17は、第1保持部11からソースプログラムを読み込み(S21)、ソースプログラムの構文解析を行って中間コードを生成する(S22)。
そして、インタープリタ17は、第3保持部13からテストデータを読み込み(S23)、中間コードを実行し(S24)、実行結果を判定部18に出力する(S25)。
The algorithm of the
The
The
判定部18は、実行プログラムの実行手段(ターゲットCPU21)の実行結果及びインタープリタ17の実行結果を対比して一致するか否かを判定する。
ここで、複数のテストデータについての実行結果のうち、同一のテストデータについてのソースプログラムと実行プログラムの実行結果を対比するためには、同一のテストデータを順にソースプログラムと実行プログラムに入力して実行させて実行結果を順に比較する方法や、実効結果にテストデータの識別情報を付加することでソースプログラムと実行プログラムの実行結果を同一のテストデータについてソートし比較する方法等を適用することができる。
The
Here, among the execution results for a plurality of test data, in order to compare the execution results of the source program and the execution program for the same test data, the same test data is sequentially input to the source program and the execution program. It is possible to apply a method of comparing the execution results in order, or a method of sorting and comparing the execution results of the source program and the execution program with respect to the same test data by adding test data identification information to the effective results. it can.
そして、判定部18は、一致又は不一致の判定結果を結果出力部19に送出し、さらにこの判定結果に基づいてコンパイラ14にバグが含まれるか否かの認定結果も結果出力部19に送出する。
Then, the
図7のフローチャートに基づいて判定部18のアルゴリズムを説明する(適宜、図1及び図8参照)。ここで図8は、第1実施形態におけるテストデータに基づく判定結果を示す表である。
判定部18は、実行プログラムの実行手段(ターゲットCPU21)及びインタープリタ17から、入力変数の組み合わせ([int a, int b], [R1, R2])が同一のテストデータの実行結果(c, R10)をそれぞれ読み込む(S31)。
そして、これら二つの実行結果(c, R10)を対比して一致しているか否かを判定し(S32)、「一致」又は「不一致」の判定結果を出力する(S33,S34)。
そして、生成したテストデータのうち一つでも「不一致」の判定結果が得られた場合はコンパイラ14にバグが含まれると認定され、全てが「一致」の場合はバグが発見されないと認定され、その旨が表示される(S35)。
The algorithm of the
The
Then, these two execution results (c, R10) are compared to determine whether or not they match (S32), and a determination result of “match” or “mismatch” is output (S33, S34).
If even one of the generated test data results in a “mismatch” determination, it is certified that the
(第2実施形態)
次に図1を参照して本発明における第2実施形態について説明する。
なお第2実施形態におけるコンパイラ評価装置10において、テストデータ生成部15の作用を除くその他の構成は、第1実施形態と共通するために重複する説明を省略する。
(Second Embodiment)
Next, a second embodiment of the present invention will be described with reference to FIG.
Note that in the
第2実施形態におけるテストデータ生成部15は、ソースプログラムを構成する関数(図2)を単位として抽出されたプログラムパスの実行又は不実行の組み合わせに基づくテストデータ(図10)を生成するものである。
ここで、プログラムパスとは、if, while, do-while, for, switch等により規定されたデータ処理の実行順番を制御す命令である。
The test
Here, the program path is an instruction that controls the execution order of data processing defined by if, while, do-while, for, switch, and the like.
図9のフローチャートに基づいて第2実施形態におけるテストデータ生成部15のアルゴリズムを説明する(適宜、図1参照)。
ここで、図9のステップS41からステップS44は、図4のステップS11からステップS14に対応するので重複する説明を省略する。
Based on the flowchart of FIG. 9, the algorithm of the test
Here, steps S41 to S44 in FIG. 9 correspond to steps S11 to S14 in FIG.
ソースプログラムの関数を構成するif, switch, while, do-while, for等で規定されるプログラムパスの構造解析が行なわれる(S45)。
なお、制御構造の条件分岐に用いられる変数については、全てのプログラムパスを実行するテストデータを生成する。この場合、ランダムに値を割り当てて全てのプログラムパスを実行する値を用いる方法、条件分岐の条件から全てのプログラムパスを実行する値を求める方法、などを用いる。
そして、図10に示すように、テストデータ生成部15は、プログラムパスの実行又は不実行の全ての組み合わせについて、対応するテストデータ出力する(S46)。
The structure analysis of the program path defined by if, switch, while, do-while, for, etc., constituting the function of the source program is performed (S45).
For variables used for conditional branching of the control structure, test data for executing all program paths is generated. In this case, a method that uses a value that randomly assigns a value and executes all program paths, a method that obtains a value that executes all program paths from conditional branch conditions, and the like are used.
Then, as shown in FIG. 10, the test
図7のフローチャートに基づいて第2実施形態における判定部18のアルゴリズムを説明する(適宜、図1及び図11参照)。図11は、第2実施形態におけるテストデータに基づく判定結果を示す表である。
判定部18は、実行プログラムの実行手段(ターゲットCPU21)及びインタープリタ17から、プログラムパスの実行又は不実行の組み合わせ([int a, int b], [R1, R2])が同一のテストデータの実行結果(c, R10)をそれぞれ読み込む(S31)。
Based on the flowchart of FIG. 7, the algorithm of the
The
そして、これら二つの実行結果を対比して一致しているか否かを判定し(S32)、「一致」又は「不一致」の判定結果を出力する(S33,S34)。
そして、生成したテストデータのうち一つでも「不一致」の判定結果が得られた場合はコンパイラ14にバグが含まれると認定され、全てが「一致」の場合はバグが発見されないと認定され、その旨が表示される(S35)。
第2実施形態によれば、一致・不一致の判定を行うテストデータの数を削減することができ、コンパイラ14にバグが含まれるか否かの認定を簡素化できる。
Then, these two execution results are compared to determine whether or not they match (S32), and a determination result of “match” or “mismatch” is output (S33, S34).
If even one of the generated test data results in a “mismatch” determination, it is certified that the
According to the second embodiment, it is possible to reduce the number of test data for performing a match / mismatch determination, and it is possible to simplify recognition of whether or not a bug is included in the
(第3実施形態)
次に図12を参照して本発明における第3実施形態について説明する。
なお第3実施形態におけるコンパイラ評価装置10は、実行プログラムの実行手段がターゲットCPUをエミュレートするために内蔵されたエミュレータ22である点を除き、その他の構成は、第1実施形態及び第2実施形態と共通する。なお、図12において図1と共通の構成又は機能を有する部分は、同一符号で示し、重複する説明を省略する。
(Third embodiment)
Next, a third embodiment of the present invention will be described with reference to FIG.
The
このエミュレータ22は、第2保持部12から実行プログラムを取得し、第3保持部13から複数のテストデータを入力して実行する。そして、エミュレータ22は、この実行結果を判定部18に出力する。
The emulator 22 acquires an execution program from the
図13のフローチャートに基づいてターゲットCPUのエミュレータ22のアルゴリズムを説明する(適宜、図12参照)。
エミュレータ22は、第2保持部12から実行プログラムを読み込む(S51)。そして、第3保持部13からテストデータを読み込んで実行プログラムを実行し(S52)、実行結果を判定部18に出力する(S53)。
第3実施形態によれば、一つのコンピュータのみで、ソースプログラムと実行プログラムの一致・不一致を判定することができる。
The algorithm of the emulator 22 of the target CPU will be described based on the flowchart of FIG. 13 (see FIG. 12 as appropriate).
The emulator 22 reads the execution program from the second holding unit 12 (S51). Then, the test data is read from the
According to the third embodiment, it is possible to determine the match / mismatch between the source program and the execution program with only one computer.
(第4実施形態)
次に図14を参照して本発明における第4実施形態について説明する。
図14は第4実施形態におけるコンパイラ評価装置の基本構成を示す構成図を示し、図15は第4実施形態の変形例を示している。そして、図14及び図15は、それぞれ図1及び図12に対応している。
なお、図14及び図15において図1及び図12と共通の構成又は機能を有する部分は、同一符号で示し、重複する説明を省略する。
(Fourth embodiment)
Next, a fourth embodiment of the present invention will be described with reference to FIG.
FIG. 14 is a block diagram showing the basic configuration of the compiler evaluation apparatus in the fourth embodiment, and FIG. 15 shows a modification of the fourth embodiment. 14 and 15 correspond to FIGS. 1 and 12, respectively.
In FIGS. 14 and 15, portions having the same configuration or function as those in FIGS. 1 and 12 are denoted by the same reference numerals, and redundant description is omitted.
第4実施形態に係るコンパイラ評価装置10は、ソースプログラムを構成する関数(図16)の内部範囲(a,b)を設定するとともにこの内部範囲(a,b)に対応する前記実行プログラム(図17)の比較範囲(A,B)を設定する範囲設定部16をさらに備えている。
The
図18のフローチャートに基づいて第4実施形態における範囲設定部16のアルゴリズムを説明する(適宜、図14参照)。なお図19は第4実施形態において範囲設定されたプログラム(範囲a,A)における実行結果の一致・不一致の判定結果を示し、図20は範囲設定されたプログラム(範囲b,B)における実行結果の一致・不一致の判定結果を示している。
Based on the flowchart of FIG. 18, the algorithm of the
範囲設定部16は、第1保持部11からソースプログラムを読み込み(S61)、関数の内部範囲(a,b)を設定する(S62)。
なお、この内部範囲の設定方法は、ソースプログラムに#pragma命令で指定する方法、ソースプログラムの何行目〜何行目と別ファイル指定する方法等が挙げられる。
そして、第2保持部12から実行プログラムを読み込み(S63)、内部範囲(a,b)に対応する実行プログラムの比較範囲(A,B)を設定する(S64)。
The
Examples of the method for setting the internal range include a method of specifying a #pragma instruction in the source program, a method of specifying a file in what number line to what line of the source program, and the like.
Then, the execution program is read from the second holding unit 12 (S63), and the comparison range (A, B) of the execution program corresponding to the internal range (a, b) is set (S64).
テストデータ生成部15は、ソースプログラムの内部範囲(a,b)及び前記実行プログラムの比較範囲(A,B)の少なくとも一方に基づいてテストデータを生成する。
第4実施形態によれば、プログラムを構成する関数にさらに内部範囲を設定するので、一致・不一致の判定を行うテストデータの数を削減することができ、コンパイラ14にバグが含まれるか否かの認定を簡素化できる。
The test
According to the fourth embodiment, since the internal range is further set in the functions constituting the program, it is possible to reduce the number of test data for determining match / mismatch, and whether or not the
(第5実施形態)
次に図21を参照して本発明における第5実施形態について説明する。
なお第5実施形態におけるコンパイラ評価装置10は、範囲設定部16(図14,図15)が、ソースプログラムのプログラムパスを単位として内部範囲(a,b:図16)及び比較範囲(A,B:図17)を設定する点を除き、その他の構成は、第4実施形態と共通するために重複する説明を省略する。
(Fifth embodiment)
Next, a fifth embodiment of the present invention will be described with reference to FIG.
In the
図21のフローチャートに基づいて第5実施形態における範囲設定部16のアルゴリズムを説明する(適宜、図14参照)。なお図22は第5実施形態において範囲設定されたプログラム(範囲a,A)における実行結果の一致・不一致の判定結果を示し、図23は範囲設定されたプログラム(範囲b,B)における実行結果の一致・不一致の判定結果を示している。
Based on the flowchart of FIG. 21, the algorithm of the
範囲設定部16は、第1保持部11からソースプログラムを読み込み(S71)、ソースプログラムの関数を構成するif, switch, while, do-while, for等で規定されるプログラムパスを抽出する(S72)。
そして、第2保持部12から実行プログラムを読み込み(S73)、内部範囲(a,b)に対応する実行プログラムの比較範囲(A,B)を設定する(S74)。
The
Then, the execution program is read from the second holding unit 12 (S73), and the comparison range (A, B) of the execution program corresponding to the internal range (a, b) is set (S74).
テストデータ生成部15は、ソースプログラムの内部範囲(a,b)及び前記実行プログラムの比較範囲(A,B)の少なくとも一方に基づいてテストデータを生成する。
第5実施形態によれば、プログラムを構成する関数にさらにプログラムパスを単位として内部範囲を設定するので、一致・不一致の判定を行うテストデータの数を削減することができ、コンパイラ14にバグが含まれるか否かの認定を簡素化できる。
The test
According to the fifth embodiment, since an internal range is further set for each function constituting the program in units of program paths, the number of test data for determining match / mismatch can be reduced, and the
以上述べた少なくともひとつの実施形態のコンパイラ評価装置によれば、生成したテストデータに対し、ソースプログラムから直接得られる実行結果と実行プログラムから直接得られる実行結果とを対比することにより、コンパイラのバグの有無を評価することが可能となる。 According to the compiler evaluation apparatus of at least one embodiment described above, a compiler bug can be obtained by comparing the execution result directly obtained from the source program with the execution result directly obtained from the execution program against the generated test data. It becomes possible to evaluate the presence or absence of.
本発明のいくつかの実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。これら実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更、組み合わせを行うことができる。これら実施形態やその変形は、発明の範囲や要旨に含まれると同様に、特許請求の範囲に記載された発明とその均等の範囲に含まれるものである。
また、コンパイラ評価装置の構成要素は、コンピュータのプロセッサで実現することも可能であり、コンパイラ評価プログラムにより動作させることが可能である。
Although several embodiments of the present invention have been described, these embodiments are presented by way of example and are not intended to limit the scope of the invention. These embodiments can be implemented in various other forms, and various omissions, replacements, changes, and combinations can be made without departing from the scope of the invention. These embodiments and their modifications are included in the scope and gist of the invention, and are also included in the invention described in the claims and the equivalents thereof.
The components of the compiler evaluation apparatus can be realized by a computer processor and can be operated by a compiler evaluation program.
10…コンパイラ評価装置、11…第1保持部、12…第2保持部、13…第3保持部、14…コンパイラ、15…テストデータ生成部、16…範囲設定部、17…インタープリタ、18…判定部、19…結果出力部、20…外部機器、21…ターゲットCPU、22…エミュレータ。
DESCRIPTION OF
Claims (7)
前記ソースプログラムをプロセッサで実行できるようにコンパイルした実行プログラムを保持する第2保持部と、
前記ソースプログラム及び前記実行プログラムの少なくとも一方に基づいてテストデータを生成するテストデータ生成部と、
前記テストデータを保持し前記実行プログラムの実行手段に送出する第3保持部と、
前記テストデータを入力し前記ソースプログラムを実行するインタープリタと、
前記実行プログラムの実行手段の実行結果及び前記インタープリタの実行結果を対比して一致するか否かを判定する判定部と、
前記ソースプログラムを構成する関数の内部範囲を設定するとともにこの内部範囲に対応する前記実行プログラムの比較範囲を設定する範囲設定部と、を備え、
前記テストデータ生成部は、前記ソースプログラムの内部範囲及び前記実行プログラムの比較範囲の少なくとも一方に基づいてテストデータを生成することを特徴とするコンパイラ評価装置。 A first holding unit for holding a source program written in a programming language;
A second holding unit holding an execution program compiled so that the source program can be executed by a processor;
A test data generation unit that generates test data based on at least one of the source program and the execution program;
A third holding unit for holding the test data and sending it to the execution means of the execution program;
An interpreter for inputting the test data and executing the source program;
A determination unit that determines whether or not the execution result of the execution unit of the execution program and the execution result of the interpreter coincide with each other ;
A range setting unit that sets an internal range of functions constituting the source program and sets a comparison range of the execution program corresponding to the internal range;
The compiler evaluation apparatus, wherein the test data generation unit generates test data based on at least one of an internal range of the source program and a comparison range of the execution program .
前記ソースプログラムをプロセッサで実行できるようにコンパイルした実行プログラムを保持するステップと、
前記ソースプログラム及び前記実行プログラムの少なくとも一方に基づいてテストデータを生成するステップと、
前記テストデータを保持しこのテストデータを前記実行プログラムの実行手段に送出するステップと、
前記テストデータを入力し前記ソースプログラムを実行するステップと、
前記実行プログラムの実行結果及び前記ソースプログラムの実行結果を対比して一致するか否かを判定するステップと、
前記ソースプログラムを構成する関数の内部範囲を設定するとともにこの内部範囲に対応する前記実行プログラムの比較範囲を設定するステップと、を含み、
前記テストデータを生成するステップでは、前記ソースプログラムの内部範囲及び前記実行プログラムの比較範囲の少なくとも一方に基づいてテストデータを生成することを特徴とするコンパイラ評価方法。 Holding a source program written in a programming language;
Holding an execution program compiled so that the source program can be executed by a processor;
Generating test data based on at least one of the source program and the execution program;
Holding the test data and sending the test data to the execution means of the execution program;
Inputting the test data and executing the source program;
Determining whether or not the execution result of the execution program and the execution result of the source program are in agreement with each other ;
Setting an internal range of functions constituting the source program and setting a comparison range of the execution program corresponding to the internal range,
A method for evaluating a compiler , wherein in the step of generating test data, test data is generated based on at least one of an internal range of the source program and a comparison range of the execution program .
プログラミング言語で記述されたソースプログラムを保持させるステップ、
前記ソースプログラムをプロセッサで実行できるようにコンパイルした実行プログラムを保持させるステップ、
前記ソースプログラム及び前記実行プログラムの少なくとも一方に基づいてテストデータを生成させるステップ、
前記テストデータを保持させこのテストデータを前記実行プログラムの実行手段に送出させるステップ、
前記テストデータを入力させ前記ソースプログラムを実行させるステップ、
前記実行プログラムの実行結果及び前記ソースプログラムの実行結果を対比させて一致するか否かを判定させるステップ、
前記ソースプログラムを構成する関数の内部範囲を設定するとともにこの内部範囲に対応する前記実行プログラムの比較範囲を設定するステップ、を実行させ、
前記テストデータを生成するステップでは、前記ソースプログラムの内部範囲及び前記実行プログラムの比較範囲の少なくとも一方に基づいてテストデータを生成することを特徴とするコンパイラ評価プログラム。 On the computer,
Holding a source program written in a programming language;
Holding an execution program compiled so that the source program can be executed by a processor;
Generating test data based on at least one of the source program and the execution program;
Holding the test data and sending the test data to the execution means of the execution program;
Inputting the test data and executing the source program;
Comparing the execution result of the execution program and the execution result of the source program to determine whether or not they match ,
Setting an internal range of functions constituting the source program and setting a comparison range of the execution program corresponding to the internal range;
In the step of generating the test data, a test data is generated based on at least one of an internal range of the source program and a comparison range of the execution program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012188008A JP5908374B2 (en) | 2012-08-28 | 2012-08-28 | Compiler evaluation apparatus, method, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012188008A JP5908374B2 (en) | 2012-08-28 | 2012-08-28 | Compiler evaluation apparatus, method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2014044678A JP2014044678A (en) | 2014-03-13 |
JP5908374B2 true JP5908374B2 (en) | 2016-04-26 |
Family
ID=50395877
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012188008A Expired - Fee Related JP5908374B2 (en) | 2012-08-28 | 2012-08-28 | Compiler evaluation apparatus, method, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5908374B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11449410B2 (en) | 2020-03-23 | 2022-09-20 | Tmaxsoft Co., Ltd | Universal runtime verification system between source language and language converted through transpiler |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01155438A (en) * | 1987-12-12 | 1989-06-19 | Hitachi Ltd | Compiler test system |
CN1567222A (en) * | 2003-07-09 | 2005-01-19 | 松下电器产业株式会社 | Programe generating device |
JP2005141406A (en) * | 2003-11-05 | 2005-06-02 | Toyota Motor Corp | Compiler inspection system and compiler inspection program |
JP2007041804A (en) * | 2005-08-02 | 2007-02-15 | Sharp Corp | Program generation device, program verification device, and verification program |
JP5303531B2 (en) * | 2010-09-28 | 2013-10-02 | 株式会社日立製作所 | Maintenance support device for embedded system |
-
2012
- 2012-08-28 JP JP2012188008A patent/JP5908374B2/en not_active Expired - Fee Related
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11449410B2 (en) | 2020-03-23 | 2022-09-20 | Tmaxsoft Co., Ltd | Universal runtime verification system between source language and language converted through transpiler |
Also Published As
Publication number | Publication date |
---|---|
JP2014044678A (en) | 2014-03-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Wang et al. | Reassembleable disassembling | |
US8898647B2 (en) | Method and apparatus for test coverage analysis | |
TWI463404B (en) | Compiling systems and methods | |
CN103197942B (en) | A kind of generation method of patch, the method for patch installing and device | |
EP3244306B1 (en) | A computer-implemented method for allowing modification of a region of original code | |
KR101053104B1 (en) | Computer Software Test Method and System | |
JP6759851B2 (en) | Program generation program, program generation method, program generator and compilation program | |
JP4905480B2 (en) | Program obfuscation program and program obfuscation device | |
JP5908374B2 (en) | Compiler evaluation apparatus, method, and program | |
JP6790869B2 (en) | Compilation method, compilation program and information processing equipment | |
JP2013152559A (en) | Program comparison analysis device and program comparison analysis method | |
JP2008165342A (en) | Source code creating method, device and program | |
JP2016128941A (en) | Output determination device, output determination method, output determination program, and static analysis device | |
Gerasimov et al. | Reachability confirmation of statically detected defects using dynamic analysis | |
WO2017204139A1 (en) | Data processing apparatus, data processing method, and program recording medium | |
JP2007226589A (en) | Program conversion system | |
JP6326838B2 (en) | Program processing apparatus, program processing method, and program processing program | |
Zakharov et al. | Compositional environment modelling for verification of GNU C programs | |
KR102524627B1 (en) | System for obfuscation of binary programs using intermediate language and method therefor | |
JP6072714B2 (en) | Program verification device | |
Gregor et al. | Using LLVM-based JIT compilation in genetic programming | |
DeVries | Mapping of UML Diagrams to Extended Petri Nets for Formal Verification | |
Cao et al. | Compiler backend generation for application specific instruction set processors | |
JP2022118310A (en) | Compilation method, development supporting device, and control system | |
Wu et al. | SourceSnippet2Binary: A Method for Searching Vulnerable Source Code Snippets in Binaries |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20150127 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20150811 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20150818 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20151014 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20160223 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20160323 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 5908374 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
LAPS | Cancellation because of no payment of annual fees |