[go: up one dir, main page]

JP2018190219A - Software specification analysis apparatus and software specification analysis method - Google Patents

Software specification analysis apparatus and software specification analysis method Download PDF

Info

Publication number
JP2018190219A
JP2018190219A JP2017092887A JP2017092887A JP2018190219A JP 2018190219 A JP2018190219 A JP 2018190219A JP 2017092887 A JP2017092887 A JP 2017092887A JP 2017092887 A JP2017092887 A JP 2017092887A JP 2018190219 A JP2018190219 A JP 2018190219A
Authority
JP
Japan
Prior art keywords
loop
information
path
path information
rule
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.)
Granted
Application number
JP2017092887A
Other languages
Japanese (ja)
Other versions
JP6802109B2 (en
Inventor
佐藤 直人
Naoto Sato
直人 佐藤
伊藤 信治
Shinji Ito
信治 伊藤
恭平 小山
Kyohei Koyama
恭平 小山
和矢 安田
Kazuya Yasuda
和矢 安田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2017092887A priority Critical patent/JP6802109B2/en
Publication of JP2018190219A publication Critical patent/JP2018190219A/en
Application granted granted Critical
Publication of JP6802109B2 publication Critical patent/JP6802109B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

【課題】ソフトウェアの仕様分析の効率化を図る。【解決手段】仕様分析装置は、ソースコードのループ文以外の部分に記号実行を行うことによりパス条件及びパス実行結果を生成し、ループ文に対して記号実行を行い、ループ文をn-1回実行した後の変数の値と、ループ文をn回実行した後の変数の値との関係式である汎化ループ内パス情報を生成し、特化ループ内パス情報のうち、任意回数だけループを実行した場合における変数の値を含む第1の特化ループ内パス情報を取得し、第1の特化ループ内パス情報に汎化ループ内パス情報を適用することにより、第1の特化ループ内パス情報よりもループ回数が1つ大きい第2の特化ループ内パス情報を生成し、第2の特化ループ内パス情報とループ外パス情報とに基づき、ソフトウェアの仕様(ルール)に関する情報を生成する。【選択図】図1PROBLEM TO BE SOLVED: To improve the efficiency of software specification analysis. SOLUTION: A specification analyzer generates a path condition and a path execution result by executing a symbol in a part other than the loop statement of the source code, executes the symbol for the loop statement, and executes the loop statement n-1. Generates the path information in the generalized loop, which is the relational expression between the value of the variable after executing the loop statement n times and the value of the variable after executing the loop statement n times, and only any number of the path information in the specialized loop. By acquiring the first specialized loop path information including the value of the variable when the loop is executed and applying the generalized loop path information to the first specialized loop path information, the first feature Generates a second in-specialized loop path information that has one more loop count than the in-loop path information, and based on the second in-loop path information and the out-of-loop path information, software specifications (rules). Generate information about. [Selection diagram] Fig. 1

Description

本発明は、ソフトウェア仕様分析装置、及びソフトウェア仕様分析方法に関する。   The present invention relates to a software specification analysis apparatus and a software specification analysis method.

特許文献1には、「分析対象のプログラムから、繰り返し制御変数を変化させて特定のケースを探索して当該特定のケースにおいて特定の処理を実施するというパターンに合致する繰り返しブロックを抽出し、分析対象のプログラムにおいて、抽出された繰り返しブロック及び当該繰り返しブロックの直後のブロックを、真の場合に特定の処理を実施し且つ偽の場合に直後のブロックの処理を実施し且つ当該真偽に関する述語関数を含む二分岐構造に置換し、二分岐構造に含まれる述語関数について論理制約を生成しておき、変換処理後のプログラムのシンボリック実行時に、上記述語関数を処理していることを検出すると、当該述語関数に対応付けられている論理制約から、述語関数の出現位置におけるパスコンディションを生成してシンボリック実行部の管理データに追加登録する」と記載されている。   Patent Document 1 states that “from a program to be analyzed, a repeated control variable is changed to search for a specific case and a repeated block that matches a pattern of performing a specific process in the specific case is extracted and analyzed. In the target program, the extracted repeated block and the block immediately following the repeated block are subjected to specific processing when true, and the processing of the immediately following block is performed when false, and the predicate function relating to the true or false When a logical constraint is generated for the predicate function included in the bifurcated structure, and when the upper descriptive function is detected during symbolic execution of the converted program, A path condition at the position where the predicate function appears is generated from the logical constraints associated with the predicate function. Is described as additional registration to "in the management data Rick execution unit.

特開2011−191985号公報Japanese Unexamined Patent Publication No. 2011-191985 C.L.リュー 著、成嶋弘/秋山仁 訳、コンピュータサイエンスのための離散数学入門、マグロウヒルブック株式会社、1986年C.L. Liu, written by Hiroshi Narishima / Jin Akiyama, Introduction to Discrete Mathematics for Computer Science, McGraw-Hill Book, Inc., 1986

特許文献1は、「シンボリック実行では、条件分岐においてその充足可能な全ての実行パスを自動的に発生させて、プログラムの網羅的な実行を可能としている。しかし、その網羅性ゆえに組み合せ爆発を起こす可能性があり、特に実装言語特有のアルゴリズムによりシンボリック実行上では本来必要としない組み合せを多く生成してしまい、無駄な探索を繰り返してしまう」との課題に対し、上記の仕組みにより上記課題の解決を図っている。   Patent Document 1 states that “in symbolic execution, all possible execution paths in a conditional branch are automatically generated to enable comprehensive execution of a program. However, due to its completeness, a combined explosion occurs. There is a possibility, and in particular, the above mechanism solves the above problem for the problem that it generates a lot of combinations that are not necessary in symbolic execution due to algorithms specific to the implementation language, and repeats useless searches. I am trying.

しかし特許文献1では、配列から特定のデータを検索するためのループ文をそれと等価な条件分岐文に置換しており、配列から特定のデータを検索するためのループ文以外のループ文を含むソースコードからルールを抽出する場合には適用することができない。   However, in Patent Document 1, a loop statement for retrieving specific data from an array is replaced with an equivalent conditional branch statement, and a source including a loop statement other than a loop statement for retrieving specific data from an array It cannot be applied when extracting rules from code.

本発明はこうした背景に鑑みてなされたものであり、ソフトウェアの仕様分析の効率化に寄与するソフトウェア仕様分析装置、及びソフトウェア仕様分析方法を提供することを目的としている。   The present invention has been made in view of such a background, and an object of the present invention is to provide a software specification analysis apparatus and a software specification analysis method that contribute to efficiency improvement of software specification analysis.

上記目的を達成するための本発明の一つは、ソフトウェアの仕様を分析する装置であって、分析対象のソフトウェアを実現するプログラムのソースコードを記憶する記憶部と、前記ソースコードに含まれているループ文の記述を特定するループ文特定部と、特定した前記ループ文以外の前記ソースコードの記述について記号実行を行うことにより、前記ソースコードのパス条件及びパス実行結果を含む情報であるループ外パス情報を、前記ループ文の実行前における変数の値と前記ループ文の実行後における変数の値とを用いて生成するループ外記号実行部と、特定した前記ループ文について記号実行を行うことにより、前記ソースコードに含まれている各変数について、前記ループ文をn−1回実行した後に
おける当該変数の値と、前記ループ文をn回実行した後における当該変数の値との関係を示す情報である汎化ループ内パス情報を生成する、ループ内記号実行部と、ループを特定回数実行した場合における前記ソースコードのパスに関する情報である特化ループ内パス情報を生成するループ内パス特化部と、前記ループ内パス特化部が生成した前記特化ループ内パス情報のうち、任意回数だけループを実行した場合における変数の値を含む第1の特化ループ内パス情報を取得し、前記第1の特化ループ内パス情報に前記汎化ループ内パス情報を適用することにより、前記第1の特化ループ内パス情報よりもループ回数が1つ大きい第2の特化ループ内パス情報を生成し、前記第2の特化ループ内パス情報と前記ループ外パス情報とに基づき、前記ソフトウェアの仕様を表すルールを含む情報であるルール情報を生成するルール生成部、を備える。
One aspect of the present invention for achieving the above object is an apparatus for analyzing software specifications, which is included in a storage unit that stores a source code of a program that realizes software to be analyzed, and the source code. A loop statement that is information including a pass condition and a pass execution result of the source code by performing symbol execution on the description of the source code other than the specified loop statement Out-of-loop symbol execution unit that generates outer path information using the value of the variable before execution of the loop statement and the value of the variable after execution of the loop statement, and symbol execution for the identified loop statement For each variable included in the source code, the value of the variable after the loop statement is executed n-1 times and the rule A generalized loop path information that is information indicating a relationship with the value of the variable after n times of execution of the loop statement, and an in-loop symbol execution unit, and the source code when the loop is executed a specific number of times When the loop is executed an arbitrary number of times in the in-loop path specialization unit that generates path information in the special loop that is information on the path, and in the special loop inside path information generated by the in-loop path specialization unit The first special loop is obtained by acquiring first special loop path information including the value of the variable in and applying the general loop path information to the first special loop path information. The second specialized loop path information having a loop count one greater than the inner path information is generated, and the software specification is expressed based on the second specialized loop path information and the out-of-loop path information. Rule generator for generating a rule information is information including a Lumpur, comprising a.

その他、本願が開示する課題、及びその解決方法は、発明を実施するための形態の欄、及び図面により明らかにされる。   In addition, the subject which this application discloses, and its solution method are clarified by the column of the form for inventing, and drawing.

本発明によれば、ソフトウェアの仕様の分析を効率よく行うことができる。   According to the present invention, it is possible to efficiently analyze software specifications.

第1実施形態の仕様分析装置の機能ブロック図である。It is a functional block diagram of the specification analyzer of a 1st embodiment. 仕様分析装置の実現に用いるハードウェアの例である。It is an example of the hardware used for implementation | achievement of a specification analyzer. ソースコードの例である。This is an example of source code. ループ外パス探索木の例である。It is an example of an out-loop path search tree. ループ外記号実行情報の例である。It is an example of out-of-loop symbol execution information. ループ外記号実行情報の例である。It is an example of out-of-loop symbol execution information. ループ外パス情報の例である。It is an example of path information outside a loop. ループ内パス探索木の例である。It is an example of a path search tree in a loop. ループ内記号実行処理を説明するフローチャートである。It is a flowchart explaining the symbol execution process in a loop. ループ内記号実行情報の例である。It is an example of the symbol execution information in a loop. 汎化ループ内パス情報の例である。It is an example of the path information in generalization loop. ループ内パス特化処理を説明するフローチャートである。It is a flowchart explaining the path specialization process in a loop. (a)、(b)はループ回数が0回の特化ループ内パス情報の例である。(A), (b) is an example of path information in the special loop where the number of loops is zero. ループ回数が1回の特化ループ内パス情報の例である。It is an example of path information in a special loop with one loop. ルール生成処理を説明するフローチャートである。It is a flowchart explaining a rule production | generation process. ループ回数が0回の場合のルールの例である。It is an example of a rule when the number of loops is 0. ループ回数が1回の場合のルールの例である。It is an example of a rule when the number of loops is one. ループの上限回数が1回に指定されている場合のルールの例である。It is an example of a rule when the upper limit number of loops is specified as 1. 第2実施形態の仕様分析装置の機能ブロック図である。It is a functional block diagram of the specification analyzer of 2nd Embodiment. ソースコードの例である。This is an example of source code. ループ外パス探索木の例である。It is an example of an out-loop path search tree. ループ外記号実行情報の例である。It is an example of out-of-loop symbol execution information. ループ外記号実行情報の例である。It is an example of out-of-loop symbol execution information. ループ外パス情報の例である。It is an example of path information outside a loop. ループ内パス探索木の例である。It is an example of a path search tree in a loop. ループ内記号実行情報の例である。It is an example of the symbol execution information in a loop. 汎化ループ内パス情報の例である。It is an example of the path information in generalization loop. 一般項化ループ内パス情報の例である。It is an example of the path information in generalization loop. 一般項化ルール情報の例である。It is an example of generalization rule information. 一般項化ルール表示画面の例である。It is an example of a generalization rule display screen. ループ上限回数の指定画面の例である。It is an example of the designation | designated screen of a loop upper limit frequency | count.

以下、図面を参照しつつ実施形態について説明する。尚、以下の説明において、同一の又は類似する構成について同一の符号を付して重複した説明を省略することがある。   Hereinafter, embodiments will be described with reference to the drawings. In the following description, the same or similar components may be denoted by the same reference numerals and redundant description may be omitted.

[第1実施形態]
図1に第1実施形態として説明するソフトウェア仕様分析装置(以下、仕様分析装置100と称する。)の機能ブロック図を示している。仕様分析装置100は、分析対象となるソフトウェアを実現しているプログラムのソースコード151について記号実行を行うことにより、上記ソフトウェアの仕様に関する情報(以下、ルール情報157とも称する。)を生成する。
[First Embodiment]
FIG. 1 shows a functional block diagram of a software specification analyzer (hereinafter referred to as a specification analyzer 100) described as the first embodiment. The specification analysis apparatus 100 generates information related to the software specifications (hereinafter also referred to as rule information 157) by performing symbol execution on the source code 151 of the program that implements the software to be analyzed.

記号実行では、ソースコードのパラメータに渡される引数をシンボル値で表し、そのシンボル値に対してソースコードの処理を実行する。その際、ソースコードの実行パスごとに、シンボル値がどのような値であればそのパスを実行するかを示す情報(以下、パス条件とも称する。)を取得する。またそのパスを実行した結果、最終的に各変数が保持する値(以下、パス実行結果とも称する。)を取得する。尚、シンボル値はパス実行結果にも現れる可能性がある。パス条件とパス実行結果の組合せは、当該パスが実行される条件と当該パスが実行された場合の結果を示し、IF-THENのルール形式で表すことができる。こ
のようなIF-THEN関係はルールとも称される。ソースコード151の全てのパスを探索し
て生成したルールの集合は、そのソースコードの仕様に相当する。
In symbol execution, an argument passed to a parameter of the source code is represented by a symbol value, and processing of the source code is executed on the symbol value. At this time, for each execution path of the source code, information (hereinafter, also referred to as a path condition) indicating what value the symbol value is to execute is acquired. In addition, as a result of executing the pass, finally, a value held by each variable (hereinafter also referred to as a pass execution result) is acquired. Note that the symbol value may also appear in the pass execution result. The combination of the path condition and the path execution result indicates a condition for executing the path and a result when the path is executed, and can be expressed in an IF-THEN rule format. Such an IF-THEN relationship is also called a rule. A set of rules generated by searching all paths of the source code 151 corresponds to the specification of the source code.

ここでソースコードがループ処理に関する記述(例えば、ソースコードがC言語で記述されている場合、while文、do文、for文等の記述ブロック。以下、ループ処理に関する記述ブロックをループ文と称する。)を含んでいる場合を考える。ソースコードがループ文を含んでいる場合、記号実行では、ループ文を1回も実行しないパス、ループ文を1回だけ実行するパス、ループ文を2回だけ実行するパスというように、ループ文の実行回数ごとにパスを生成することになる。例えば、最大でループ文を4回実行する可能性がある場合、ループ文の実行回数が0回のときのパス、1回のときのパス、2回のときのパス、3回のときのパス、4回のときのパスという、合計5つのパスを生成することになる。ここでさらに、ループ文のループ条件が引数に依存する場合を考える。上述のとおり、記号実行ではパラメータに渡される引数をシンボル値で表すため、ループ条件が引数に依存する場合、ループ条件にシンボル値が現れる。このシンボル値は実際の値を持たず、シンボル値を含むループ条件の成立/不成立を決定することができない可能性があり、ループ文を最大で何回実行する可能性があるかについても決定することができない。   Here, the source code is a description related to loop processing (for example, when the source code is described in C language, a description block such as a while statement, a do statement, a for statement, etc. Hereinafter, a description block related to the loop processing is referred to as a loop statement. ). If the source code contains a loop statement, symbol execution is a loop statement that does not execute the loop statement once, a path that executes the loop statement only once, a path that executes the loop statement only twice, and so on. A path is generated for each execution. For example, if there is a possibility of executing a loop statement four times at the maximum, the path when the loop statement is executed 0 times, the pass 1 time, the pass 2 times, the pass 3 times A total of five paths, that is, four paths, are generated. Now consider the case where the loop condition of the loop statement depends on the argument. As described above, in symbol execution, an argument passed to a parameter is represented by a symbol value. Therefore, when the loop condition depends on the argument, the symbol value appears in the loop condition. This symbol value has no actual value, and it may not be possible to determine whether the loop condition including the symbol value is satisfied or not, and also determine how many times the loop statement may be executed. I can't.

このようにループ文の最大実行回数を決定することができないと、探索するパスの数が無限となり、記号実行の処理を終了することができない。この問題を回避する方法としては、例えば、ループ文の上限回数を予め設定しておき、ループ回数が上限回数を超えた時点でループから脱出する方法がある。この方法によれば、探索するパス数を有限に止めることができる。   If the maximum number of executions of the loop statement cannot be determined in this way, the number of paths to be searched becomes infinite, and the symbol execution process cannot be terminated. As a method for avoiding this problem, for example, there is a method in which an upper limit number of loop statements is set in advance and the loop is escaped when the loop number exceeds the upper limit number. According to this method, the number of paths to be searched can be limited.

しかし例えば、ループの上限回数がL回に設定されていた場合、L回のループを実行した場合のパスを探索する際は、ループ文に対してL回の記号実行を繰り返し行う必要がある
。そのため、例えば、ループ文のステップ数が大きい場合、記号実行により多くのリソースが消費されてしまい、また仕様を表すルールを取得するまでの時間も長くなる。
However, for example, when the upper limit number of loops is set to L times, it is necessary to repeat symbol execution L times for a loop sentence when searching for a path when the L loops are executed. Therefore, for example, when the number of steps of a loop sentence is large, a lot of resources are consumed by symbol execution, and the time until acquiring a rule representing a specification also becomes long.

また上限回数が実際のループの最大実行回数よりも小さい場合、ルールの抽出漏れが生じる。例えば、実際の最大実行回数が5回のループ文に対して上限回数を3回に設定して記号実行を行った場合、ループ文の実行回数4回の場合のルールと、5回の場合についてはルールを抽出することができない。   Further, when the upper limit number is smaller than the actual maximum number of executions of the loop, rule extraction omission occurs. For example, when a symbol statement is executed with the upper limit set to 3 for a loop statement with an actual maximum execution count of 5, the rule for the loop statement execution count of 4 and the case of 5 Cannot extract rules.

以上の理由から、対象のソースコードがループ文を含む場合、ユーザはルールの抽出漏れの有無を判断する必要がある。そしてルールの抽出漏れがあると判断した場合、ユーザはループの上限回数を増加して再度記号実行を行うことになる。このように、ループ文を含むソースコードからルールを抽出する場合、上限回数を変更して複数回の記号実行を行わねばならず、ユーザは煩雑な作業を強いられる。本実施形態の仕様分析装置100は、ソフトウェアの仕様を記号実行により分析する際に生じるこうした課題を解決するものである。   For the above reasons, when the target source code includes a loop statement, the user needs to determine whether or not there is a rule extraction omission. If it is determined that there is omission of rule extraction, the user increases the upper limit number of loops and executes the symbol again. As described above, when a rule is extracted from a source code including a loop sentence, the upper limit number of times must be changed and a plurality of symbol executions must be performed, and the user is forced to perform complicated work. The specification analyzing apparatus 100 according to the present embodiment solves such problems that occur when analyzing software specifications by symbol execution.

図1に示すように、仕様分析装置100は、情報記憶部110、ループ文特定部111、ループ外記号実行部112、ループ内記号実行部113、ループ内パス特化部114、ルール生成部115、及び入出力処理部116を備える。仕様分析装置100は、これらの機能以外に、例えば、オペレーティングシステム、デバイスドライバ、DBMS(DataBase Management System)等を備えていてもよい。   As shown in FIG. 1, the specification analyzing apparatus 100 includes an information storage unit 110, a loop sentence specifying unit 111, an out-loop symbol executing unit 112, an in-loop symbol executing unit 113, an in-loop path specializing unit 114, and a rule generating unit 115. And an input / output processing unit 116. In addition to these functions, the specification analysis apparatus 100 may include, for example, an operating system, a device driver, a DBMS (DataBase Management System), and the like.

図2に仕様分析装置100の実現に用いるハードウェア(情報処理装置50)の一例を示す。情報処理装置50は、プロセッサ51、主記憶装置52、補助記憶装置53、入力装置54、出力装置55、及び通信装置56の各構成を備える。これらはバス等の通信手段を介して互いに通信可能に接続されている。尚、情報処理装置50の全部又は一部を、例えば、クラウドシステムにおけるクラウドサーバ等の仮想的な資源を用いて実現してもよい。   FIG. 2 shows an example of hardware (information processing apparatus 50) used for realizing the specification analysis apparatus 100. The information processing device 50 includes each configuration of a processor 51, a main storage device 52, an auxiliary storage device 53, an input device 54, an output device 55, and a communication device 56. These are communicably connected to each other via a communication means such as a bus. In addition, you may implement | achieve all or one part of the information processing apparatus 50 using virtual resources, such as a cloud server in a cloud system, for example.

プロセッサ51は、例えば、CPU(Central Processing Unit)、MPU(Micro Processing Unit)、GPU(Graphics Processing Unit)、DSP(Digital Signal Processor)等を用いて構成されている。プロセッサ51が、主記憶装置52に格納されているプログラムを読み出して実行することにより、仕様分析装置100の全部又は一部の機能が実現される。主記憶装置52は、例えば、ROM(Read Only Memory)、RAM(Random Access Memory)、不揮発性半導体メモリ(NVRAM(Non Volatile RAM))等であり、プログラムやデータを記憶する。   The processor 51 is configured using, for example, a CPU (Central Processing Unit), an MPU (Micro Processing Unit), a GPU (Graphics Processing Unit), a DSP (Digital Signal Processor), and the like. The processor 51 reads out and executes a program stored in the main storage device 52, thereby realizing all or part of the functions of the specification analysis device 100. The main storage device 52 is, for example, a ROM (Read Only Memory), a RAM (Random Access Memory), a nonvolatile semiconductor memory (NVRAM (Non Volatile RAM)), etc., and stores programs and data.

仕様分析装置100が備える上記の各機能は、例えば、プロセッサ51が、主記憶装置52や補助記憶装置53に格納されているプログラムを読み出して実行することにより実現される。またこれらの機能は、例えば、仕様分析装置100が備えるハードウェア(FPGA(Field-Programmable Gate Array)、ASIC(Application Specific Integrated Circuit)等)によって実現される。   Each of the above functions provided in the specification analysis apparatus 100 is realized by, for example, the processor 51 reading and executing a program stored in the main storage device 52 or the auxiliary storage device 53. These functions are realized by, for example, hardware (FPGA (Field-Programmable Gate Array), ASIC (Application Specific Integrated Circuit), etc.) provided in the specification analysis apparatus 100.

補助記憶装置53は、例えば、ハードディスクドライブ、SSD(Solid State Drive
)、光学式記憶装置(CD(Compact Disc)、DVD(Digital Versatile Disc)等)、ストレージシステム、ICカード、SDメモリカードや光学式記録媒体等の記録媒体に対するデータの読取/書込装置等である。補助記憶装置53に格納されているプログラムやデータは主記憶装置52に随時ロードされる。補助記憶装置53は、例えば、ネットワークストレージのように仕様分析装置100とは独立した構成としてもよい。
The auxiliary storage device 53 is, for example, a hard disk drive, SSD (Solid State Drive)
), Optical storage devices (CD (Compact Disc), DVD (Digital Versatile Disc), etc.), storage systems, IC cards, SD memory cards, and data reading / writing devices for recording media such as optical recording media is there. Programs and data stored in the auxiliary storage device 53 are loaded into the main storage device 52 as needed. The auxiliary storage device 53 may have a configuration independent of the specification analysis device 100, such as a network storage.

入力装置54は、外部からのデータの入力を受け付けるインタフェースであり、例えば、記録媒体(不揮発性メモリ、光学式記録媒体、磁気記録媒体、光磁気記録媒体等)からのデータの読取装置、キーボード、マウス、タッチパネル等である。尚、例えば、仕様分析装置100が、通信装置56を介して他の装置からデータの入力を受け付ける構成としてもよい。   The input device 54 is an interface that accepts input of data from the outside. For example, a data reading device from a recording medium (nonvolatile memory, optical recording medium, magnetic recording medium, magneto-optical recording medium, etc.), keyboard, Mouse, touch panel, etc. For example, the specification analysis device 100 may be configured to receive data input from another device via the communication device 56.

出力装置55は、処理経過や処理結果等のデータや情報を外部に提供するユーザインタ
フェースであり、例えば、画面表示装置(液晶ディスプレイ(Liquid Crystal Display)、プロジェクタ、グラフィックカード等)、印字装置、記録媒体へのデータの記録装置等である。尚、例えば、仕様分析装置100が、処理経過や処理結果等のデータを通信装置56を介して他の装置に提供する構成としてもよい。
The output device 55 is a user interface that provides data and information such as processing progress and processing results to the outside. For example, a screen display device (liquid crystal display, projector, graphic card, etc.), printing device, recording For example, a recording device for recording data on a medium. For example, the specification analysis device 100 may provide data such as processing progress and processing results to other devices via the communication device 56.

通信装置56は、他の装置や素子との間の通信を実現する、有線方式又は無線方式の通信インタフェースであり、例えば、NIC(Network Interface Card)、無線通信モジュール等である。   The communication device 56 is a wired or wireless communication interface that realizes communication with other devices and elements, and is, for example, a NIC (Network Interface Card), a wireless communication module, or the like.

図1に戻り、前述した機能のうち、情報記憶部110は、ソースコード151、ループ外記号実行情報152、ループ外パス情報153、ループ内記号実行情報154、汎化ループ内パス情報155、特化ループ内パス情報156、及びルール情報157を記憶する。情報記憶部110は、これらの情報を、例えば、ファイルシステムやDBMSによって管理する。   Returning to FIG. 1, among the functions described above, the information storage unit 110 includes the source code 151, out-of-loop symbol execution information 152, out-of-loop path information 153, in-loop symbol execution information 154, generalized in-loop path information 155, special information. In-loop path information 156 and rule information 157 are stored. The information storage unit 110 manages these pieces of information using, for example, a file system or a DBMS.

ループ文特定部111は、ソースコード151の記述からループ文を特定(抽出)する。仕様分析装置100は、例えば、入力装置54や通信装置56を介して、ユーザや他の情報処理システム等からソースコード151を取得する。   The loop sentence specifying unit 111 specifies (extracts) a loop sentence from the description of the source code 151. For example, the specification analysis apparatus 100 acquires the source code 151 from the user, another information processing system, or the like via the input device 54 or the communication device 56.

ループ外記号実行部112は、ソースコード151の、ループ文特定部111が特定したループ文以外の記述(以下、ループ外記述とも称する。)について記号実行を行うことにより、ループ外パス情報153を生成する。ループ外記号実行部112は、記号実行を行う際に利用する各種の情報をループ外記号実行情報152として管理し、上記記号実行に際してループ外記号実行情報152を適宜参照する。ループ外記号実行情報152及びループ外パス情報153の詳細については後述する。   The out-of-loop symbol executing unit 112 performs symbol execution on the description other than the loop statement specified by the loop statement specifying unit 111 (hereinafter also referred to as “out-of-loop description”) in the source code 151, thereby obtaining out-of-loop path information 153. Generate. The out-of-loop symbol execution unit 112 manages various types of information used when performing symbol execution as out-of-loop symbol execution information 152, and refers to the out-of-loop symbol execution information 152 as appropriate when executing the above symbol execution. Details of the out-of-loop symbol execution information 152 and the out-of-loop path information 153 will be described later.

ループ内記号実行部113は、ループ文特定部111が特定したループ文(以下、ループ内記述とも称する。)について記号実行を行うことにより汎化ループ内パス情報155を生成する。ループ内記号実行部113は、記号実行を行う際に利用する各種の情報をループ内記号実行情報154として管理し、上記記号実行に際しループ内記号実行情報154を適宜参照する。ループ内記号実行情報154及び汎化ループ内パス情報155の詳細については後述する。   The in-loop symbol execution unit 113 generates the generalized in-loop path information 155 by performing symbol execution on the loop statement (hereinafter also referred to as “in-loop description”) specified by the loop statement specifying unit 111. The in-loop symbol execution unit 113 manages various types of information used when performing symbol execution as the in-loop symbol execution information 154, and appropriately refers to the in-loop symbol execution information 154 when executing the symbol. Details of the in-loop symbol execution information 154 and the generalized loop path information 155 will be described later.

ループ内パス特化部114は、汎化ループ内パス情報155をルール生成部115からの指示に基づきインスタンス化することにより特化ループ内パス情報156を生成する。尚、新たな特化ループ内パス情報156の生成に際し、ループ内パス特化部114が、既に生成済みの特化ループ内パス情報156を利用することがある。特化ループ内パス情報156の詳細については後述する。   The in-loop path specialization unit 114 instantiates the generalized loop path information 155 based on an instruction from the rule generation unit 115 to generate the special loop path information 156. Note that, when generating new specialized loop path information 156, the intra-loop path specializing unit 114 may use the already-created specialized loop path information 156. Details of the specialized loop path information 156 will be described later.

ルール生成部115は、仕様分析装置100が備える各機能(情報記憶部110、ループ外記号実行部112、ループ内記号実行部113、及びループ内パス特化部114)を統括的に制御する。ルール生成部115は、例えば、入力装置54や通信装置56を介してユーザ等から受け付けた、ループの上限回数(以下、ループ上限回数とも称する。)に基づき、ループ内パス特化部114の実行を制御する。またルール生成部115は、例えば、ループ外パス情報153及び特化ループ内パス情報156に基づきルール情報157を生成する。   The rule generation unit 115 comprehensively controls each function (the information storage unit 110, the out-loop symbol execution unit 112, the in-loop symbol execution unit 113, and the in-loop path specialization unit 114) included in the specification analysis apparatus 100. For example, the rule generation unit 115 executes the intra-loop path specialization unit 114 based on the upper limit number of loops (hereinafter also referred to as the loop upper limit number) received from the user or the like via the input device 54 or the communication device 56. To control. Further, the rule generation unit 115 generates the rule information 157 based on, for example, the out-loop path information 153 and the specialized loop path information 156.

入出力処理部116は、情報の受け付けや情報の提示を行うユーザインタフェースを提供する。入出力処理部116は、例えば、入力装置54や通信装置56を介してループ上限回数等の情報の指定を受け付ける。また入出力処理部116は、例えば、ルール生成部
115が生成したルール情報157を出力装置55や通信装置56に出力する。尚、入出力処理部116は、例えば、ループ文ごとにループ上限回数の指定を受け付ける。また入出力処理部116は、例えば、ソースコード151に含まれている全てのループ文について一括指定によりループ上限回数の指定を受け付ける。また入出力処理部116は、ユーザからループ上限回数の入力を受け付ける際にソースコード151を取得してこれを出力装置55に表示する。
The input / output processing unit 116 provides a user interface for receiving information and presenting information. For example, the input / output processing unit 116 receives designation of information such as the upper limit number of loops via the input device 54 and the communication device 56. For example, the input / output processing unit 116 outputs the rule information 157 generated by the rule generation unit 115 to the output device 55 and the communication device 56. Note that the input / output processing unit 116 accepts designation of the upper limit number of loops for each loop sentence, for example. For example, the input / output processing unit 116 accepts designation of the upper limit number of loops by batch designation for all the loop statements included in the source code 151. Further, the input / output processing unit 116 acquires the source code 151 and displays it on the output device 55 when receiving the input of the upper limit number of loops from the user.

続いて、図3に示すソースコード151を例として、仕様分析装置100の具体的な動作について説明する。尚、ソースコード151はC言語で記述されており、ループ文301を含むものとする。   Next, a specific operation of the specification analysis apparatus 100 will be described using the source code 151 illustrated in FIG. 3 as an example. The source code 151 is described in C language and includes a loop statement 301.

ループ文特定部111は、ソースコード151からループ文301を特定する。ループ外記号実行部112は、ソースコード151のループ文301以外の記述(ループ外記述)を対象として記号実行を行う。ループ内記号実行部113は、ソースコード151のループ文301の記述(ループ内記述)を対象として記号実行を行う。   The loop sentence specifying unit 111 specifies the loop sentence 301 from the source code 151. The out-of-loop symbol execution unit 112 executes symbol execution for a description (outside loop description) other than the loop statement 301 of the source code 151. The in-loop symbol execution unit 113 executes symbol execution for the description (in-loop description) of the loop statement 301 of the source code 151.

図4は、ループ外記号実行部112が、ループ外記述の記号実行に際して図3に示すソースコード151に基づき生成する探索木(以下、ループ外パス探索木400と称する。)である。ループ外記号実行部112は、ループ外パス探索木400を利用してループ外記号実行情報152を生成する。同図に示すように、ループ外パス探索木400は、夫々「N0」〜「N7」の識別子(以下、ノード名と称する。)が付与された8つのノードを有する。   FIG. 4 shows a search tree (hereinafter referred to as an out-of-loop path search tree 400) generated by the outside-loop symbol execution unit 112 based on the source code 151 shown in FIG. The out-of-loop symbol execution unit 112 uses the out-of-loop path search tree 400 to generate out-of-loop symbol execution information 152. As shown in the figure, the out-loop path search tree 400 has eight nodes assigned identifiers (hereinafter referred to as node names) of “N0” to “N7”, respectively.

上記8つのノードのうち、ノード名が「N0」のノードは図3のソースコード151の1行目の記述に対応し、ソースコード151の開始点を意味する「START」という手続きを
含む。またノード名が「N1」のノードは、図3に示すソースコード151の2行目の記述に対応し、「z=0」という手続きを含む。またノード名が「N2」のノードは、図3に示す
ソースコード151の3〜10行目の記述、即ちループ文301に対応する。このようにループ外記号実行部112は、ループ文301の記述についてはブラックボックスとして取り扱う。
Among the eight nodes, the node whose node name is “N0” corresponds to the description of the first line of the source code 151 in FIG. 3 and includes a procedure “START” which means the start point of the source code 151. The node whose node name is “N1” corresponds to the description on the second line of the source code 151 shown in FIG. 3 and includes a procedure “z = 0”. The node whose node name is “N2” corresponds to the description of the 3rd to 10th lines of the source code 151 shown in FIG. In this way, the out-of-loop symbol execution unit 112 handles the description of the loop statement 301 as a black box.

ノード名が「N3」のノードは、図3に示すソースコード151の11行目に対応する。当該行には条件分岐の記述「if (x % 2 == 0) {」が記述されており、ループ外記号実行
部112は、当該行を分岐点として、条件が「True」の場合と「False」の場合の2通り
のパスを探索する。尚、以下の説明において、これら2つのパスの夫々に識別子(以下、パス名と称する。)として「P1」,「P2」を付与する。
The node whose node name is “N3” corresponds to the eleventh line of the source code 151 shown in FIG. The conditional branch description “if (x% 2 == 0) {” is described in the relevant line, and the out-of-loop symbol execution unit 112 uses the relevant line as a branch point and the condition is “True”. Two paths in the case of “False” are searched. In the following description, “P1” and “P2” are assigned to each of these two paths as identifiers (hereinafter referred to as path names).

図5及び図6は、図4のループ外パス探索木400に基づきループ外記号実行部112が生成するループ外記号実行情報152である。このうち図5に示すループ外記号実行情報152は、パス名が「P1」のパスに対応し、一方、図6に示すループ外記号実行情報152は、パス名が「P2」のパスに対応する。これらの図に示すように、ループ外記号実行情報152は、ノード名1521、行番号1522、パス条件1523、ループ前変数状態1524、及び変数状態1525の各項目を含む一つ以上のレコードで構成されている。ループ外記号実行情報152のレコードの一つはループ外パス探索木のノードの一つに対応している。   5 and 6 show the out-of-loop symbol execution information 152 generated by the out-of-loop symbol execution unit 112 based on the out-of-loop path search tree 400 of FIG. Of these, the out-of-loop symbol execution information 152 shown in FIG. 5 corresponds to the path whose path name is “P1”, while the out-of-loop symbol execution information 152 shown in FIG. 6 corresponds to the path whose path name is “P2”. To do. As shown in these figures, the out-of-loop symbol execution information 152 is composed of one or more records including items of a node name 1521, a line number 1522, a path condition 1523, a pre-loop variable state 1524, and a variable state 1525. Has been. One of the records of the out-of-loop symbol execution information 152 corresponds to one of the nodes in the out-of-loop path search tree.

上記項目のうち、ノード名1521には、ノード名が設定される。行番号1522には、当該ノードに対応する、図3に示すソースコード151の行番号が設定される。   Among the above items, a node name is set in the node name 1521. In the line number 1522, the line number of the source code 151 shown in FIG. 3 corresponding to the node is set.

パス条件1523には、当該ノードに到達するための条件(以下、パス条件とも称する
。)が設定される。ここで図5はソースコード151の11行目で「True」側のパス「P1」を探索することを選択した場合に対応するので、ノード名が「N3」のノードのパス条件1523には11行目の分岐条件が「True」となるための条件「AL_x % 2 == 0」が設定
されている。一方、図6はソースコード151の11行目で「False」側のパス「P2」を
探索することを選択した場合に対応するので、ノード名が「N3」のノードのパス条件1523には11行目の分岐条件が「False」となるための条件「!(AL_x % 2 == 0)」が設定
されている。
In the path condition 1523, a condition for reaching the node (hereinafter also referred to as a path condition) is set. Here, FIG. 5 corresponds to the case where the search for the path “P1” on the “True” side is selected in the eleventh line of the source code 151, so that the path condition 1523 of the node whose node name is “N3” is 11 The condition “AL_x% 2 == 0” for setting the branch condition of the line to “True” is set. On the other hand, FIG. 6 corresponds to the case where it is selected to search for the path “P2” on the “False” side in the 11th line of the source code 151, so that the path condition 1523 of the node whose node name is “N3” is 11 A condition “! (AL_x% 2 == 0)” for setting the branch condition of the line to “False” is set.

ループ前変数状態1524には、ループ文301の実行前の各変数の値(以下、ループ前変数状態とも称する。)が設定される。本例の場合、ノード名が「N2」のノードではループ文301の実行前の変数「x」、「y」、「z」の値を保持している。図5又は図6に
示す「BL_x」,「BL_y」,BL_y」は、夫々、ループ文301の実行前の変数「x」,「y
」,「z」の値を表すシンボル値である(「BL」は「Before Loop」の略)。「BL_x==X」は、ループ文301の実行前の変数「x」の値がシンボル値「X」であることを、「BL_y==Y」は、ループ文301の実行前の変数「y」の値がシンボル値「Y」であることを、「BL_z==0」は、ループ文301の実行前の変数「z」の値が「0」であることを示す。
In the pre-loop variable state 1524, a value of each variable before the execution of the loop statement 301 (hereinafter also referred to as a pre-loop variable state) is set. In this example, the node whose node name is “N2” holds the values of the variables “x”, “y”, and “z” before the loop statement 301 is executed. “BL_x”, “BL_y”, and BL_y shown in FIG. 5 or 6 are variables “x” and “y” before execution of the loop statement 301, respectively.
”And“ z ”are symbol values (“ BL ”is an abbreviation of“ Before Loop ”). “BL_x == X” indicates that the value of the variable “x” before execution of the loop statement 301 is the symbol value “X”, and “BL_y == Y” indicates that the variable “y” before execution of the loop statement 301 “BL_z == 0” indicates that the value of the variable “z” before execution of the loop statement 301 is “0”.

変数状態1525には、上記各ノードの夫々における変数の値(以下、変数状態とも称する。)が設定される。例えば、ノード名が「N0」のノードでは、変数「x」、「y」の値はそれぞれ「X」、「Y」である。尚、「X」、「Y」は、それぞれ、パラメータ変数「x」
、「y」に渡される引数を表すシンボル値である。
In the variable state 1525, a value of a variable in each of the above nodes (hereinafter also referred to as a variable state) is set. For example, in the node whose node name is “N0”, the values of the variables “x” and “y” are “X” and “Y”, respectively. "X" and "Y" are parameter variables "x"
, A symbol value representing an argument passed to “y”.

ノード名が「N2」のノードでは、ループ文301を実行した結果として、変数「x」に
「AL_x」を代入している。ここで「AL_x」は、ループ文実行後の変数「x」の値を表すシ
ンボル値である(「AL」は「After Loop」の略)。前述したように、ループ外記号実行部112はループ文301をブラックボックスとして取り扱うため、ループ文301の実行結果として上記のように新たなシンボル値を変数に代入している。
In the node whose node name is “N2”, “AL_x” is substituted into the variable “x” as a result of executing the loop statement 301. Here, “AL_x” is a symbol value representing the value of the variable “x” after execution of the loop statement (“AL” is an abbreviation of “After Loop”). As described above, since the out-of-loop symbol execution unit 112 handles the loop statement 301 as a black box, the new symbol value is substituted into the variable as described above as the execution result of the loop statement 301.

図7は、ループ外記号実行部112が生成するループ外パス情報153である。ループ外パス情報153は、パス名1531、パス終端ノード1532、パス条件1533、ループ前変数状態1534、及び変数状態1535の各項目からなる一つ以上のレコードで構成されている。ループ外パス情報153の1つのレコードは一つのパスに対応している。   FIG. 7 shows the out-of-loop path information 153 generated by the out-of-loop symbol execution unit 112. The out-loop path information 153 includes one or more records including items of a path name 1531, a path end node 1532, a path condition 1533, a pre-loop variable state 1534, and a variable state 1535. One record of the out-loop path information 153 corresponds to one path.

上記項目のうち、パス名1531には、当該パスのパス名が設定される。パス終端ノード1532には、当該パスの終端ノードのノード名が設定される。図4に示すループ外パス探索木の場合はノード名が「N5」、「N7」のノードが終端ノードとなる。   Among the above items, the path name 1531 is set with the path name of the path. In the path termination node 1532, the node name of the termination node of the path is set. In the case of the out-loop path search tree shown in FIG. 4, nodes with node names “N5” and “N7” are terminal nodes.

パス条件1533には、終端ノードに到達した時点におけるパス条件が設定される。ループ前変数状態1534には、上記終端ノードに到達した時点におけるループ前変数状態が設定される。変数状態1535には、上記終端ノードに到達した時点における各変数の値(変数状態)が設定される。   In the path condition 1533, a path condition at the time when the terminal node is reached is set. The pre-loop variable state 1534 is set to the pre-loop variable state when the terminal node is reached. The variable state 1535 is set with the value of each variable (variable state) when the terminal node is reached.

図8は、ループ内記号実行部113が、ループ文301の記述(以下、ループ内記述とも称する。)について記号実行を行うに際して生成する探索木(以下、ループ内パス探索木800と称する。)である。ループ内記号実行部113は、ループ内パス探索木800を利用してループ外記号実行情報152を生成する。同図に示すように、ループ内パス探索木800は、夫々「M0」〜「M8」のノード名が付与された9つのノードを有する。   FIG. 8 shows a search tree (hereinafter referred to as an in-loop path search tree 800) generated when the in-loop symbol execution unit 113 executes symbol execution for the description of the loop statement 301 (hereinafter also referred to as an in-loop description). It is. The in-loop symbol execution unit 113 uses the in-loop path search tree 800 to generate out-loop symbol execution information 152. As shown in the figure, the in-loop path search tree 800 has nine nodes assigned node names “M0” to “M8”, respectively.

上記9つのノードのうち、ノード名が「M0」のノードは図3に示すソースコード151
の3行目の記述に対応し、ソースコード151の開始点を意味する「START」という手続
きを含む。またノード名が「M1」のノードは、図3に示すソースコード151の3行目の記述に対応し、「while (z < y) {」という条件(以下、ループ条件とも称する。)の記
述を含む。
Among the above nine nodes, the node whose node name is “M0” is the source code 151 shown in FIG.
Corresponding to the description on the third line of “”, and includes a procedure “START” which means the starting point of the source code 151. The node whose node name is “M1” corresponds to the description on the third line of the source code 151 shown in FIG. 3, and the description of the condition “while (z <y) {” (hereinafter also referred to as a loop condition). including.

ノード名が「M2」のノードは、ソースコード151の4行目に対応する。またノード名
が「M5」及び「M8」のノードは、ループ文301から脱出した後のノードを表し、ノード名が「M5」のノードは3行目のループ条件「z % 3 == 0」が「True」となる場合のパスの終端ノードに、ノード名が「M8」のノードは3行目のループ条件「z % 3 == 0」が「False」となるパスの終端ノードに、夫々対応する。尚、以下の説明において、これら2つの
パスの夫々にパス名として「Q1」,「Q2」を付与する。
The node whose node name is “M2” corresponds to the fourth line of the source code 151. Nodes with node names “M5” and “M8” represent nodes after exiting from the loop statement 301, and a node with node name “M5” is a loop condition “z% 3 == 0” on the third line. The node with the node name “M8” is the end node of the path where the loop condition “z% 3 == 0” is “False”, respectively. Correspond. In the following description, “Q1” and “Q2” are given as path names to each of these two paths.

図9は、ループ内記号実行部113が行う、ループ内記述の記号実行に関する処理(以下、ループ内記号実行処理S900と称する。)を説明するフローチャートである。以下、同図とともにループ内記号実行処理S900について説明する。以下において、符号の前に付した「S」の文字は処理ステップを意味する。   FIG. 9 is a flowchart for explaining processing related to symbol execution of the in-loop description performed by the in-loop symbol execution unit 113 (hereinafter referred to as “in-loop symbol execution processing S900”). The in-loop symbol execution processing S900 will be described below with reference to FIG. In the following, the letter “S” added in front of the reference sign means a processing step.

まずループ内記号実行部113は、ループ文特定部111が特定したループ内記述(図3の例ではループ文301)を取得する(S911)。   First, the in-loop symbol execution unit 113 acquires the in-loop description specified by the loop statement specifying unit 111 (the loop statement 301 in the example of FIG. 3) (S911).

続いて、ループ内記号実行部113は、ループ内記述の記号実行の開始に先立ち、当該ループの実行前の変数の値(以下、初項とも称する。)を生成(記憶、設定)し、ループ内記号実行情報154の内容(後述する初項1543)を更新する。本例では、ループ内記号実行部113は、変数xに対する初項を「x0」とし、ループ実行前の変数「x」の値「BL_x」を生成する(S912)。 Subsequently, the in-loop symbol execution unit 113 generates (stores and sets) a value of a variable (hereinafter also referred to as the first term) before the execution of the loop before starting the symbol execution of the in-loop description. The content of the inner symbol execution information 154 (first term 1543 described later) is updated. In this example, the in-loop symbol execution unit 113 sets “x 0” as the first term for the variable x, and generates the value “BL_x” of the variable “x” before the loop execution (S912).

続いて、ループ内記号実行部113は、ループ内記述についてパスの探索を行い、ループ内記号実行情報154の内容(後述するパス条件1544及び変数状態1545)を更新する(S913)。上記パスの探索に際し、ループ内記号実行部113は、n-1回のル
ープの実行後の変数の値を用いてn回のループの実行時の変数の値を生成する。例えば、
図3のループ文301の3行目の記述について記号実行を行う場合、ループ内記号実行部113は、ループ条件「z < y」に基づき、n-1回のループの実行後の変数の値「zn-1」及び「yn-1」を用いて「zn-1 < yn-1」(但し、n>0。以下省略))というパス条件を生成する。同様に5行目の記述について記号実行を行う場合、ループ内記号実行部113は、n
回のループの実行時の変数「xn」の値を、ループをn-1回実行後の変数の値を用いて「xn=xn-1*2+2」と表す。
Subsequently, the in-loop symbol execution unit 113 performs a path search for the in-loop description, and updates the contents of the in-loop symbol execution information 154 (a path condition 1544 and a variable state 1545 described later) (S913). When searching for the path, the in-loop symbol execution unit 113 uses the value of the variable after the execution of n−1 loops to generate the value of the variable at the time of execution of the n loops. For example,
When performing symbol execution for the description on the third line of the loop statement 301 in FIG. 3, the in-loop symbol execution unit 113 sets the value of the variable after execution of n−1 loops based on the loop condition “z <y”. Using “z n-1 ” and “y n-1 ”, a path condition of “z n-1 <y n-1 ” (where n> 0, hereinafter omitted)) is generated. Similarly, when performing symbol execution for the description on the fifth line, the in-loop symbol execution unit 113 sets n
The value of the variable “x n ” when the loop is executed is expressed as “x n = x n-1 * 2 + 2” using the value of the variable after the loop is executed n−1 times.

続いて、ループ内記号実行部113は、ループ内記述についてパスの探索を進めた結果、ループ内記述の末端に到達したか否かを判定する(S914)。例えば、図3のループ文301の10行目の記述はループ内記述の末端に相当する。ループ内記号実行部113がループ内記述の末端に到達したと判定した場合(S914:YES)、処理はS915に進む。ループ内記号実行部113がループ内記述の末端に到達していないと判定した場合(S914:NO)、処理はS913に戻る。   Subsequently, the in-loop symbol execution unit 113 determines whether or not the end of the in-loop description has been reached as a result of the path search for the in-loop description (S914). For example, the description on the 10th line of the loop statement 301 in FIG. 3 corresponds to the end of the description in the loop. If the in-loop symbol execution unit 113 determines that the end of the in-loop description has been reached (S914: YES), the process proceeds to S915. If the in-loop symbol execution unit 113 determines that the end of the in-loop description has not been reached (S914: NO), the process returns to S913.

S915では、ループ内記号実行部113は、ループ内記述におけるループ条件の否定に相当する条件をパス条件に追加する。ここでループ条件の否定は、n回のループ実行後
の変数の値を用いて生成する。例えば、図3のループ文301におけるループ条件「zn < yn)」の否定は「!(zn < yn)」となる(但しn≧0。以下省略。)。尚、以下の説明に
おいて、S915で追加した条件式のことを汎化脱出条件式と称する。
In S915, the in-loop symbol execution unit 113 adds a condition corresponding to the negation of the loop condition in the in-loop description to the path condition. Here, the negation of the loop condition is generated using the value of the variable after n loop executions. For example, the negation of the loop condition “z n <y n ” ”in the loop statement 301 of FIG. 3 becomes“! (Z n <y n ) ”(provided that n ≧ 0, hereinafter omitted). In the following description, the conditional expression added in S915 is referred to as a generalized escape conditional expression.

続いて、ループ内記号実行部113は、S913におけるパスの探索の過程で生成したパス条件及び変数状態に基づき汎化ループ内パス情報155を生成する(S916)。具体的には、ループ内記号実行部113は、まずS915の時点におけるノード名、初項、パス条件、及び変数状態を取得する。そしてループ内記号実行部113は、取得した変数状態に基づき、取得したパス条件に現れるn-1回のループ実行後の変数の値を、n回のループ実行後の変数の値を用いた式に置き換える。例えば、図3のソースコード151のループ文301について生成したパス条件「zn-1 < yn-1」は、ノード名が「M5」のノードに
おける変数状態「yn=yn-1」及び「zn=zn-1+1」に基づき「zn-1 < yn」というパス条件に
変換する。ループ内記号実行部113は、こうして生成したパス条件に加え、ループ内記号実行情報154から取得したノード名1541、初項1543、及び変数状態1545を汎化ループ内パス情報155として記憶する。
Subsequently, the in-loop symbol execution unit 113 generates generalized in-loop path information 155 based on the path condition and variable state generated in the path search process in S913 (S916). Specifically, the in-loop symbol execution unit 113 first acquires the node name, the first term, the path condition, and the variable state at the time of S915. Then, the in-loop symbol execution unit 113 uses the value of the variable after the n-1 loop executions appearing in the acquired path condition as an expression using the value of the variable after the n loop executions based on the acquired variable state. Replace with For example, the path condition “z n-1 <y n-1 ” generated for the loop statement 301 of the source code 151 in FIG. 3 is the variable state “y n = y n-1 ” at the node whose node name is “M5”. And “z n −1 <y n ” based on “z n = z n−1 +1”. The in-loop symbol execution unit 113 stores the node name 1541, the first term 1543, and the variable state 1545 acquired from the in-loop symbol execution information 154 as the generalized loop path information 155 in addition to the path condition thus generated.

続いて、ループ内記号実行部113は、ループ文に含まれている全てのパスを探索済みか否かを判定する(S917)。ループ内記号実行部113が全てのパスを探索済みであると判定した場合(S917:YES)、ループ内記号実行処理S900は終了する。一方、ループ内記号実行部113が全てのパスを探索済みでない(未探索のパスがある)と判定した場合(S917:NO)、処理はS918に進む。   Subsequently, the in-loop symbol execution unit 113 determines whether or not all paths included in the loop sentence have been searched (S917). If the in-loop symbol execution unit 113 determines that all paths have been searched (S917: YES), the in-loop symbol execution processing S900 ends. On the other hand, if the in-loop symbol execution unit 113 determines that all paths have not been searched (there is an unsearched path) (S917: NO), the process proceeds to S918.

S918では、ループ内記号実行部113は、未探索のパスを探索すべくS913からの処理を開始する。   In S918, the in-loop symbol execution unit 113 starts the process from S913 to search for an unsearched path.

図10に図3のループ文301に基づくループ内記号実行情報154を示す。同図に示すように、ループ内記号実行情報154は、ノード名1541、行番号1542、初項1543、パス条件1544、及び変数状態1545の各項目を含む1つ以上のレコードで構成されている。ループ内記号実行情報154のレコードの一つはノードの一つに対応している。   FIG. 10 shows in-loop symbol execution information 154 based on the loop statement 301 of FIG. As shown in the figure, the in-loop symbol execution information 154 is composed of one or more records including items of a node name 1541, a line number 1542, an initial term 1543, a path condition 1544, and a variable state 1545. . One record of the in-loop symbol execution information 154 corresponds to one of the nodes.

上記項目のうち、ノード名1541には、ノード名が設定される。行番号1542には、当該ノードに対応するソースコード151の行番号が設定される。初項1543には、前述した初項が設定される。パス条件1544には当該ノードの前述したパス条件が設定される。前述したように、パス条件はループをn-1回実行後の変数の値を用いて表される
。変数状態1545には当該ノードにおける前述した変数状態が設定される。前述したように、ループn回実行時の変数状態はループn-1回実行後の変数状態を用いて表される。
Among the above items, a node name is set in the node name 1541. In the line number 1542, the line number of the source code 151 corresponding to the node is set. The first term described above is set in the first term 1543. In the path condition 1544, the above-described path condition of the node is set. As described above, the pass condition is expressed using the value of the variable after the loop is executed n-1 times. In the variable state 1545, the above-described variable state in the node is set. As described above, the variable state at the time of executing the loop n times is expressed using the variable state after the execution of the loop n-1 times.

図11に図3のループ文301に基づき生成される汎化ループ内パス情報155を示す。同図に示すように、汎化ループ内パス情報155は、パス名1551、パス終端ノード1552、初項1553、パス条件1554、及び変数状態1555の各項目を有する一つ以上のレコードで構成されている。汎化ループ内パス情報155のレコードの一つはパス(以下、汎化ループ内パスとも称する。)の一つに対応している。   FIG. 11 shows the generalized loop path information 155 generated based on the loop statement 301 of FIG. As shown in the figure, the generalized loop path information 155 is composed of one or more records having items of a path name 1551, a path end node 1552, an initial term 1553, a path condition 1554, and a variable state 1555. ing. One record of the generalized loop path information 155 corresponds to one of the paths (hereinafter also referred to as a generalized loop path).

上記項目のうち、パス名1551には、当該パスのパス名が設定される。パス終端ノード1552には、パスの終端のノードが設定される。初項1553には、初項が設定される。パス条件1554には、パス条件が設定される。変数状態1555には、変数状態が設定される。   Among the above items, the path name 1551 is set to the path name of the path. In the path termination node 1552, a node at the end of the path is set. In the first term 1553, the first term is set. In the path condition 1554, a path condition is set. A variable state is set in the variable state 1555.

図12は、ループ内パス特化部114が行う処理(以下、ループ内パス特化処理S1200と称する。)を説明するフローチャートである。以下、同図とともにループ内パス特化処理S1200について説明する。   FIG. 12 is a flowchart for describing processing performed by the in-loop path specializing unit 114 (hereinafter referred to as in-loop path specializing process S1200). The in-loop path specialization process S1200 will be described below with reference to FIG.

まずループ内パス特化部114は、汎化ループ内パス情報155を取得する(S121
1)。続いて、ループ内パス特化部114は、特化ループ内パス情報156を参照し、ループ回数が0回の特化ループ内パス情報を生成済みか否かを判定する(S1212)。ル
ープ内パス特化部114がループ回数0回の特化ループ内パス情報を生成済みと判定した
場合(S1212:YES)、処理はS1215に進む。ループ内パス特化部114がループ回数が0回の特化ループ内パス情報が生成済みでない(未生成である)と判定した場
合(S1212:NO)、処理はS1213に進む。
First, the in-loop path specialization unit 114 acquires the generalized loop path information 155 (S121).
1). Subsequently, the intra-loop path specialization unit 114 refers to the special loop inner path information 156 and determines whether or not special loop inner path information with the number of loops of 0 has been generated (S1212). When the in-loop path specializing unit 114 determines that the in-loop information about the special loop with the loop count of 0 has been generated (S1212: YES), the process proceeds to S1215. If the in-loop path specializing unit 114 determines that the in-loop information about the special loop with 0 loops has not been generated (not generated) (S1212: NO), the process proceeds to S1213.

ループ内パス特化部114は、S1211で取得した汎化ループ内パス情報155に基づき、ループ回数が0回の特化ループ内パス情報156を生成する(S1213)。   The intra-loop path specialization unit 114 generates special loop internal path information 156 with the number of loops being 0 based on the generalized loop internal path information 155 acquired in S1211 (S1213).

図13(a)に、図11の汎化ループ内パス情報155に基づきループ内パス特化部114が生成する、ループ回数が0回の特化ループ内パス情報156を示す。同図に示すよ
うに、特化ループ内パス情報156は、パス名1561、パス終端ノード1562、初項1563、パス条件1564、及び変数状態1565の各項目を含む一つ以上のレコードで構成されている。特化ループ内パス情報156のレコードの一つは一つのパス(以下、特化ループ内パスとも称する。)に対応している。ループ内パス特化部114は、上記ループ回数が0回の特化ループ内パスを汎化ループ内パスごとに1つ生成する。
FIG. 13A shows specialized loop path information 156 with zero loops, which is generated by the in-loop path specialization unit 114 based on the generalized loop path information 155 of FIG. As shown in the figure, the path information 156 in the specialized loop is composed of one or more records including items of a path name 1561, a path end node 1562, an initial term 1563, a path condition 1564, and a variable status 1565. ing. One of the records of the specialized loop path information 156 corresponds to one path (hereinafter also referred to as a specialized loop path). The intra-loop path specialization unit 114 generates one special intra-loop path for each general intra-loop path with the above loop count of zero.

上記項目のうち、パス終端ノード1562及び初項1563は、汎化ループ内パス情報155におけるパス終端ノード1552及び初項1553を継承する。パス条件1564及び変数状態1565については、以下に示すように、ループ内パス特化部114がパス条件1554及び初項1553に基づき生成する。   Among the above items, the path termination node 1562 and the first term 1563 inherit the path termination node 1552 and the first term 1553 in the generalized loop path information 155. The path condition 1564 and the variable state 1565 are generated based on the path condition 1554 and the first term 1553 by the in-loop path specializing unit 114 as described below.

まずループ内パス特化部114は、汎化ループ内パス情報155のパス条件1554をループ回数0回でインスタンス化する。具体的には、ループ内パス特化部114は、パス
条件1554に現れる、n回のループを実行した後の変数の値に対してn=0を代入する。尚、n=0であるので、ループ内パス特化部114は、パス条件1554を構成する論理式の
うち「n > 0」という条件付きの論理式は使用せず、前述した汎化脱出条件式のみを使用
する。例えば、図11の汎化ループ内パス情報155のパス名1551が「Q1」のパスの場合、ループ内パス特化部114は、「(zn -1) < yn」と「(zn -1) % 3 == 0」の各式については「n > 0」という条件付きであるのでこれらは使用せず、汎化脱出条件式である
「!(zn< yn)」においてn=0とすることにより取得される「!(z0 < y0)」というパス条件を使用する。尚、以下の説明において、このように汎化脱出条件式をインスタンス化して得られる条件式のことを特化脱出条件式と称する。
First, the intra-loop path specializing unit 114 instantiates the path condition 1554 of the generalized loop intra-path information 155 with the number of loops of zero. Specifically, the in-loop path specializing unit 114 substitutes n = 0 for the value of the variable that appears in the path condition 1554 after executing n loops. Since n = 0, the in-loop path specializing unit 114 does not use the logical expression with the condition “n> 0” among the logical expressions constituting the path condition 1554, and the generalization escape condition described above. Use only expressions. For example, when the path name 1551 of the path information 155 in the generalized loop in FIG. 11 is “Q1”, the in-loop path specializing unit 114 selects “(z n −1) <y n ” and “(z n -1) For each expression of% 3 == 0, there is a condition that “n> 0”, so these are not used, and in the generalized escape conditional expression “! (Z n <y n )”, n A path condition of “! (Z 0 <y 0 )” obtained by setting = 0 is used. In the following description, a conditional expression obtained by instantiating the generalized escape conditional expression is referred to as a specialized escape conditional expression.

続いて、ループ内パス特化部114は、変数状態1565を生成する。ここでループ回数が0回のとき変数状態1565は初項1563と一致し、また初項1563はループ実
行前の変数の値に相当する。そこでループ内パス特化部114は、0回のループを実行し
た後の変数の値を、初項として保持しているループ実行前の変数の値で表す。例えば、図11に示す汎化ループ内パス情報155のパス名1551が「Q1」のパスの場合、0回の
ループを実行した後の変数の値「x0」は初項1553の式「x0=BL_x」より「x0=BL_x」と表す。
Subsequently, the in-loop path specialization unit 114 generates a variable state 1565. Here, when the number of loops is 0, the variable state 1565 coincides with the first term 1563, and the first term 1563 corresponds to the value of the variable before the loop execution. Therefore, the in-loop path specializing unit 114 represents the value of the variable after executing the loop 0 times as the value of the variable before the loop execution held as the first term. For example, when the path name 1551 of the path information 155 in the generalized loop shown in FIG. 11 is “Q1”, the value “x 0” of the variable after executing 0 loops is expressed by the expression “x in the first term 1553. From0 = BL_x”, it is expressed as “x 0 = BL_x”.

図12に戻り、続いて、ループ内パス特化部114は、S1213で生成したパス条件に現れる初項をループ実行前の変数の値を含む式に置換する(S1214)。例えば、図11に示す汎化ループ内パス情報155の「Q1」の場合、ループ内パス特化部114は、パス条件「!(z0< y0)」を、初項1553の式「z0=BL_z」及び「y0=BL_y」に基づき「!(BL_z < BL_y)」と表す。 Returning to FIG. 12, subsequently, the in-loop path specialization unit 114 replaces the first term appearing in the path condition generated in S1213 with an expression including the value of the variable before the loop execution (S1214). For example, in the case of “Q1” in the generalized loop path information 155 shown in FIG. 11, the in-loop path specialization unit 114 sets the path condition “! (Z 0 <y 0 )” to the expression “z” in the first term 1553. Based on “ 0 = BL_z” and “y 0 = BL_y”, it is expressed as “! (BL_z <BL_y)”.

図13(b)に、図13(a)のループ回数が0回の特化ループ内パス情報156につ
いて上記置換を行った後の特化ループ内パス情報156を示す。
FIG. 13B shows the specialized loop path information 156 after the above-described replacement is performed on the specialized loop path information 156 having the loop count of 0 in FIG.

図12に戻り、続いて、ループ内パス特化部114は、生成済みの特化ループ内パス情報156のうちループ回数が最大のものを取得する(S1215)。尚、以下の説明において、ここのときに取得した特化ループ内パス情報156のループ回数をK-1回とする。   Returning to FIG. 12, subsequently, the in-loop path specialization unit 114 acquires the generated in-specialized loop path information 156 having the maximum number of loops (S1215). In the following description, the loop count of the specialized loop path information 156 acquired at this time is K-1 times.

続いて、ループ内パス特化部114は、取得した特化ループ内パス情報(ループ回数はK-1回であるものとする。)と、S1211で取得した汎化ループ内パス情報155との
組み合わせに基づき、ループ回数がK回の特化ループ内パス情報156を生成する(S1
216)。尚、例えば、ループ回数がK-1回の特化ループ内パス情報156が2つ、汎化
ループ内パス情報155が2つである場合、ループ内パス特化部114は、ループ回数がK回の特化ループ内パス情報156を4つ生成する。
Subsequently, the intra-loop path specializing unit 114 performs the processing between the acquired special loop inner path information (the number of loops is K-1) and the generalized intra-loop path information 155 acquired in S1211. Based on the combination, the path information 156 in the special loop with the loop count K times is generated (S1).
216). For example, when there are two specialized loop path information 156 and two generalized loop path information 155 with a loop count of K−1, the intra-loop path specialization unit 114 determines that the loop count is K. Four pieces of special loop in-loop path information 156 are generated.

まずループ内パス特化部114は、変数状態1565を生成するため、汎化ループ内パス情報155に含まれるn及びn-1を、K及びK-1にインスタンス化する。さらにループ内パス特化部114は、ループ回数がK-1回の特化ループ内パス情報156の変数状態に基づ
き、ループをK-1回実行後の変数の値を、ループ実行前の変数の値を含む式に置換する。
First, the in-loop path specializing unit 114 instantiates n and n−1 included in the generalized loop path information 155 into K and K−1 in order to generate the variable state 1565. Further, the in-loop path specializing unit 114 calculates the value of the variable after executing the loop K-1 times based on the variable state of the specialized loop path information 156 having the number of loops K−1 times, and the variable before the loop execution. Replace with an expression containing the value of.

例えば、図11の汎化ループ内パス情報155のパス名が「Q1」のパスの変数状態「xn=xn-1 * 2 + 2」から、ループ回数が1回の特化ループ内パス情報を生成する場合、ループ内パス特化部114は、まず「xn=xn-1 * 2 + 2」を「x1=x0 * 2 + 2」とインスタンス化する。さらにループ内パス特化部114は、ループ回数が0回の特化ループ内パス情報1
56におけるパス名が「Q1」の変数状態「x0=BL_x」に基づき、「x1=BL_x* 2 + 2」を生
成する。またループ内パス特化部114は、以上と同様の方法で「y1=BL_y」及び「z1=BL_z + 1」を生成する。
For example, from the variable state “x n = x n-1 * 2 + 2” of the path whose path name is “Q1” in the generalized loop path information 155 in FIG. When generating information, the in-loop path specializing unit 114 first instantiates “x n = x n−1 * 2 +2” as “x 1 = x 0 * 2 +2”. Further, the in-loop path specializing unit 114 specifies the in-loop path information 1 with 0 loops.
Based on the variable state “x 0 = BL_x” with the path name “Q1” in 56, “x 1 = BL_x * 2 + 2” is generated. Further, the in-loop path specializing unit 114 performs “y 1 = BL_y” and “z 1 = BL_z” in the same manner as described above. + 1 ”is generated.

続いて、パス条件1564を生成するため、ループ内パス特化部114は、S1215で取得した特化ループ内パス情報156のパス条件1564から、前述した特化脱出条件式を除外する。例えば、ループ回数が0回の特化ループ内パス情報156におけるパス名
が「Q1」のパスの場合、ループ内パス特化部114は、特化脱出条件式「!(BL_z < BL_y)」を除外する。尚、以下において、特化脱出条件式を除外した後に残る式を脱出式除外式と称する。
Subsequently, in order to generate the path condition 1564, the in-loop path specializing unit 114 excludes the above-described specialized escape condition expression from the path condition 1564 of the specialized loop path information 156 acquired in S1215. For example, when the path name in the path information 156 in the special loop with the loop count of 0 is “Q1”, the path specialization unit 114 in the loop sets the special escape conditional expression “! (BL_z <BL_y)”. exclude. In the following, an expression remaining after excluding the specialized escape conditional expression is referred to as an escape expression exclusion expression.

続いて、ループ内パス特化部114は、汎化ループ内パスのパス条件をループ回数K回
でインスタンス化する。例えば、汎化ループ内パス情報155の「Q1」のパス条件を、ループ回数1回でインスタンス化する場合、ループ内パス特化部114は、「(zn -1) < yn && (zn -1) % 3 == 0 && !(zn < yn)」のnに1を代入することで、「(z1-1) < y1 && (z1 -1) % 3 == 0 && !(z1< y1)」を得る。さらにループ内パス特化部114は、特化ループ
内パス情報の変数状態に基づき、ループをK回実行後の変数の値を、ループ実行前の変数
の値を含む式に置換する。上記の例の場合、ループ内パス特化部114は、「y1=BL_y」
及び「z1=BL_z+ 1」に基づき、「(z1 -1) < y1&& (z1 -1) % 3 == 0 && !(z1 < y1)」か
ら「((BL_z + 1) -1) < BL_y && ((BL_z+ 1) -1) % 3 == 0 && !((BL_z + 1) < BL_y)」
を生成する。そしてループ内パス特化部114は、生成した上記式を、上記脱出式除外式に論理積結合する。
Subsequently, the in-loop path specializing unit 114 instantiates the path condition of the generalized loop path by the number of loops K times. For example, when instantiating the path condition of “Q1” in the generalized loop path information 155 with one loop count, the intra-loop path specialization unit 114 reads “(z n −1) <y n && (z n -1)% 3 == 0 &&! (z n <y n ) '' by substituting 1 for n, we get `` (z 1 -1) <y 1 && (z 1 -1)% 3 == 0 &&! (Z 1 <y 1 ) ”. Further, the in-loop path specializing unit 114 replaces the value of the variable after executing the loop K times with an expression including the value of the variable before executing the loop based on the variable state of the in-loop path information. In the case of the above example, the in-loop path specializing unit 114 sets “y 1 = BL_y”.
And (z 1 = BL_z + 1) from ((z 1 -1) <y 1 && (z 1 -1)% 3 == 0 &&! (Z 1 <y 1 )) to ((BL_z + 1) -1) <BL_y && ((BL_z + 1) -1)% 3 == 0 &&! ((BL_z + 1) <BL_y) ''
Is generated. Then, the in-loop path specializing unit 114 ANDs the generated expression with the escape expression exclusion expression.

図14にループ回数が1回の特化ループ内パス情報156の例を示す。同図において、
パス名1561における「Q1-Q1」は、特化ループ内パス情報156のパス名1561が
「Q1」のパスと、汎化ループ内パス情報155のパス名1551が「Q1」のパスとに基づき生成したパスであることを示す。パス終端ノード1562は、生成元の汎化ループ内パス情報155のパス終端ノード1552を継承する。初項1563は、生成元の特化ルー
プ内パス情報156の初項1563を継承する。変数状態1565は、汎化ループ内パス情報155の変数状態1555と特化ループ内パス情報156の変数状態1565とに基づき、前述した方法で生成する。またパス条件1564は、特化ループ内パス情報156のパス条件1564、汎化ループ内パス情報155のパス条件1554、及び特化ループ内パス情報156の変数状態1565に基づき生成する。
FIG. 14 shows an example of the specialized loop path information 156 with one loop. In the figure,
“Q1-Q1” in the path name 1561 is based on a path whose path name 1561 of the path information 156 in the specialized loop is “Q1” and a path whose path name 1551 of the path information 1155 in the generalized loop is “Q1”. Indicates the generated path. The path termination node 1562 inherits the path termination node 1552 of the generation source generalized loop path information 155. The first term 1563 inherits the first term 1563 of the special loop path information 156 of the generation source. The variable state 1565 is generated by the above-described method based on the variable state 1555 of the generalized loop path information 155 and the variable state 1565 of the specialized loop path information 156. The path condition 1564 is generated based on the path condition 1564 of the path information 156 in the specialized loop, the path condition 1554 of the path information 155 in the generalized loop, and the variable state 1565 of the path information 156 in the specialized loop.

図15は、以上に説明した各機能(情報記憶部110、ループ外記号実行部112、ループ内記号実行部113、及びループ内パス特化部114)を利用して、ルール生成部115がルール情報を生成する処理(以下、ルール生成処理S1500と称する。)を説明するフローチャートである。以下、同図とともにルール生成処理S1500について説明する。   FIG. 15 shows that the rule generation unit 115 uses the functions described above (the information storage unit 110, the out-loop symbol execution unit 112, the in-loop symbol execution unit 113, and the in-loop path specialization unit 114). It is a flowchart explaining the process (henceforth rule generation process S1500) which produces | generates information. The rule generation process S1500 will be described below with reference to FIG.

まずルール生成部115は、入力装置54や通信装置56を介して、ループ上限回数を取得する(S1511)。   First, the rule generation unit 115 acquires the loop upper limit count via the input device 54 and the communication device 56 (S1511).

続いて、ルール生成部115は、ルール情報157を参照し、取得したループ上限回数に対応するルールを生成済みか否かを判定する(S1512)。ルール生成部115が上限回数に対応するルールを生成済みであると判定した場合(S1512:YES)、ルール生成処理S1500は終了する。ルール生成部115が上限回数に対応するルールを未生成であると判定した場合(S1512:NO)、処理はS1513に進む。   Subsequently, the rule generation unit 115 refers to the rule information 157 and determines whether or not a rule corresponding to the acquired loop upper limit count has been generated (S1512). When the rule generation unit 115 determines that the rule corresponding to the upper limit number has been generated (S1512: YES), the rule generation processing S1500 ends. When the rule generation unit 115 determines that the rule corresponding to the upper limit number has not been generated (S1512: NO), the process proceeds to S1513.

S1513では、ルール生成部115は、ループ内パス特化部114を制御してループ内パス特化処理S1200を実行することにより、既に生成済みのループ回数がK-1回の
特化ループ内パス情報156に基づき、ループ回数がK回の特化ループ内パス情報156
を生成する。
In S1513, the rule generation unit 115 controls the in-loop path specialization unit 114 to execute the in-loop path specialization process S1200, thereby allowing the number of loops already generated to be K-1 times in the special loop. Based on the information 156, the path information 156 in the specialized loop with the number of loops of K times
Is generated.

続いて、ルール生成部115は、ループ外パス情報153を取得する(S1514)。続いて、ルール生成部115は、S1513で生成したループ回数がK回の特化ループ内
パス情報156と、S1514で取得したループ外パス情報153との組み合わせに基づき、ループ回数がK回のルールを生成する(S1515)。例えば、ルール生成部115
は、ループ回数がK回の特化ループ内パス情報156の特化ループ内パスが4つ、かつ、
取得したループ外パス情報153のループ外パスが2つである場合、ループ回数がK回の
ルールを8つ生成する。
Subsequently, the rule generation unit 115 acquires the out-loop path information 153 (S1514). Subsequently, the rule generation unit 115 creates a rule with the number of loops of K times based on the combination of the specialized loop path information 156 with the number of loops generated at S1513 and the out-loop path information 153 acquired at S1514. Is generated (S1515). For example, the rule generation unit 115
Has four special loop paths in the special loop path information 156 with K loops, and
If there are two out-of-loop paths in the acquired out-of-loop path information 153, eight rules with a loop count of K times are generated.

まずルール生成部115は、特化ループ内パス情報156のパス条件1564とループ外パス情報153のパス条件1533とを論理積で結合することにより、ルールのパス条件を生成する。そしてルール生成部115は、生成したルールのパス条件に現れるループを実行した後の変数の値を表すシンボル値を、ループを実行する前の変数の値を表すシンボル値を含む式に置換する。さらにルール生成部115は、ループ外パス情報153のループ前変数状態1534に基づき、ループ実行前の変数の値を表すシンボル値を、当該変数が実際に保持している値に置換する。   First, the rule generation unit 115 generates a rule path condition by combining the path condition 1564 of the path information 156 in the specialized loop and the path condition 1533 of the path information 153 outside the loop by a logical product. Then, the rule generation unit 115 replaces the symbol value representing the value of the variable after executing the loop appearing in the path condition of the generated rule with an expression including the symbol value representing the value of the variable before executing the loop. Further, based on the pre-loop variable state 1534 of the out-of-loop path information 153, the rule generation unit 115 replaces the symbol value representing the value of the variable before the loop execution with the value actually held by the variable.

例えば、図7に示すループ外パス情報153のパス名1531が「P1」のパスと、図13(b)に示すループ回数が0回の特化ループ内パス情報156のパス名1561が「Q1
」のパスとからパス条件を生成する場合は次のようになる。まず、ルール生成部115は、パス名1531が「P1」のパスのパス条件1533は「AL_x % 2 == 0」、ループ回数
が0回の特化ループ内パス情報156のパス条件1564は「!(BL_z < BL_y)」であるこ
とから、これらを論理積結合することにより「AL_x % 2 == 0 && !(BL_z < BL_y)」を生
成する。ここで上記式に現れるループ実行後の変数の値「AL_x」は「x0」に一致することに注目する。また上記「x0」の値は、上記特化ループ内パス情報156の変数状態156
5から「x0=BL_x」である。そこでルール生成部115は、「AL_x」を「BL_x」に置換す
ることにより「BL_x % 2 == 0 && !(BL_z < BL_y)」を生成する。またループ外パス情報
153のループ前変数状態1534より「BL_x == X」、「BL_y == Y」、「BL_z == 0」
であるので、これらに基づき、ルール生成部115は、パス条件「X % 2 == 0 && !(0 < Y)」を生成する。
For example, the path name 1531 of the out-of-loop path information 153 shown in FIG. 7 is “P1”, and the path name 1561 of the in-loop information 156 with 0 loops shown in FIG. 13B is “Q1”.
When the path condition is generated from the path “”, it is as follows. First, the rule generation unit 115 sets “AL_x% 2 == 0” for the path condition 1533 for the path whose path name 1531 is “P1”, and the path condition 1564 for the path information 156 in the specialized loop with the loop count 0 is “ ! (BL_z <BL_y) ”, so that“ AL_x% 2 == 0 &&! (BL_z <BL_y) ”is generated by ANDing these. Here, note that the value “AL_x” of the variable after loop execution appearing in the above equation matches “x 0 ”. Further, the value of “x 0 ” is the variable state 156 of the path information 156 in the specialized loop.
5 to “x 0 = BL_x”. Therefore, the rule generation unit 115 generates “BL_x% 2 == 0 &&! (BL_z <BL_y)” by replacing “AL_x” with “BL_x”. Further, “BL_x == X”, “BL_y == Y”, “BL_z == 0” from the pre-loop variable state 1534 of the out-of-loop path information 153.
Therefore, based on these, the rule generation unit 115 generates a path condition “X% 2 == 0 &&! (0 <Y)”.

続いて、ルール生成部115は、ループ外パス情報153の変数状態1535と、特化ループ内パス情報156の変数状態1565とに基づき、パス実行結果を生成する。具体的には、ルール生成部115は、ループ外パス情報153の変数状態1535に現れるループ実行後の変数の値を表すシンボル値を、ループ実行前の変数の値を表すシンボル値に置換する。即ち、ルール生成部115は、ループ外パス情報153のループ前変数状態1534に基づき、ループを実行する前の変数の値を表すシンボル値を、当該変数が実際に保持している値に置換する。   Subsequently, the rule generation unit 115 generates a path execution result based on the variable state 1535 of the out-loop path information 153 and the variable state 1565 of the specialized loop path information 156. Specifically, the rule generation unit 115 replaces the symbol value representing the value of the variable after loop execution appearing in the variable state 1535 of the out-of-loop path information 153 with the symbol value representing the value of the variable before loop execution. That is, based on the pre-loop variable state 1534 of the out-of-loop path information 153, the rule generation unit 115 replaces the symbol value representing the value of the variable before executing the loop with the value actually held by the variable. .

例えば、ルール生成部115が、ループ外パス情報153のパス名1531が「P1」のパスと、ループ回数が0回の特化ループ内パス情報156のパス名1561が「Q1」のパ
スとに基づきパス実行結果を生成する場合は次のようになる。まずループ外パス情報153の変数状態1535は「x=AL_x」、特化ループ内パス情報156の変数状態1565は「x0=BL_x」である。また前述したように「AL_x」は「x0」に一致するので「x=BL_x」が
得られる。そしてルール生成部115は、ループ外パス情報153のループ前変数状態1534に基づき「x=X」を得る。同様の方法により、ルール生成部115は、「y=Y」及び「z=X」を得る。ここで例えば、ソースコード151において戻り値として返す変数の値
のみをルールのパス実行結果として採用するものとした場合、ルール生成部115は、図3に示したソースコード151の16行目の記述に基づき、変数zの値を表す「z=X」をパス実行結果とする。
For example, the rule generation unit 115 determines that the path name 1531 of the out-of-loop path information 153 is “P1” and the path name 1561 of the specialized loop path information 156 whose number of loops is 0 is “Q1”. When generating a pass execution result based on this, it is as follows. First, the variable state 1535 of the out-of-loop path information 153 is “x = AL_x”, and the variable state 1565 of the in-loop information 156 is “x 0 = BL_x”. As described above, “AL_x” matches “x 0 ”, so that “x = BL_x” is obtained. Then, the rule generation unit 115 obtains “x = X” based on the pre-loop variable state 1534 of the out-loop path information 153. The rule generation unit 115 obtains “y = Y” and “z = X” by the same method. Here, for example, when only the value of the variable returned as the return value in the source code 151 is adopted as the rule path execution result, the rule generation unit 115 describes the 16th line of the source code 151 shown in FIG. Based on the above, “z = X” representing the value of the variable z is taken as the pass execution result.

続いて、ルール生成部115は、生成した複数のルールに重複がある場合、重複するルールを削除する。また生成したルールのパス条件の充足可能性を確認し、充足不能と判明した場合はそのルールを削除する(S1516)。尚、論理式の充足可能性を確認する方法として例えば推論規則を用いる方法があるが、充足可能性を確認する方法は必ずしも限定されない。   Subsequently, when there is an overlap in the plurality of generated rules, the rule generation unit 115 deletes the overlapping rule. Further, the possibility of satisfying the path condition of the generated rule is confirmed, and if it is found that the rule is unsatisfiable, the rule is deleted (S1516). As a method for confirming the satisfiability of a logical expression, for example, there is a method using an inference rule, but the method for confirming the satisfiability is not necessarily limited.

図16は、ループ外パス情報153とループ回数が0回の特化ループ内パス情報156
に基づきルール生成部115が生成する、ループ回数が0回の場合のルール情報157の
例である。同図に示すように、ルール情報157は、パス名1571、パス条件1572、及びパス実行結果1573の3つの項目を有する一つ以上のレコードで構成されている。
FIG. 16 shows the path information 153 outside the loop and the path information 156 in the specialized loop with the loop count being zero.
This is an example of the rule information 157 generated by the rule generation unit 115 based on the above and when the number of loops is zero. As shown in the figure, the rule information 157 is composed of one or more records having three items: a path name 1571, a path condition 1572, and a path execution result 1573.

パス名1571には、生成元を特定する情報が設定される。例えば、「P1-Q1」は、当
該ルールが、ループ外パス情報153の「P1」と、ループ回数0回の特化ループ内パス情
報156の「Q1」に基づき生成されたことを示す。パス条件1572、及びパス実行結果1573には、前述した方法で生成された値が設定される。尚、本例では「P1-Q2」と「P1-Q1」のレコードの内容が重複しており、この場合、ルール生成部115は一方(例えば「P1-Q2」)を前述したS1516にて削除する。同様に「P2-Q2」も「P2-Q1」と重複し
ているため、ルール生成部115は一方をS1516の処理で削除する。
In the path name 1571, information for specifying the generation source is set. For example, “P1-Q1” indicates that the rule is generated based on “P1” of the out-of-loop path information 153 and “Q1” of the specialized in-loop path information 156 with the loop count of 0. In the path condition 1572 and the path execution result 1573, values generated by the above-described method are set. In this example, the contents of the records “P1-Q2” and “P1-Q1” are duplicated. In this case, the rule generation unit 115 deletes one (for example, “P1-Q2”) in S1516 described above. To do. Similarly, since “P2-Q2” is also duplicated with “P2-Q1”, the rule generation unit 115 deletes one in the process of S1516.

図17は、ループ外パス情報153とループ回数1回の特化ループ内パス情報156に
基づきルール生成部115が生成する、ループ回数が1回の場合のルール情報157の例
である。同図に示すように、このルール情報157は、パス名1571、パス条件1572、及びパス実行結果1573の3つの項目を有する一つ以上のレコードで構成されてい
る。
FIG. 17 is an example of the rule information 157 when the number of loops is one, which is generated by the rule generation unit 115 based on the out-loop path information 153 and the specialized loop path information 156 with one loop. As shown in the figure, this rule information 157 is composed of one or more records having three items: a path name 1571, a path condition 1572, and a path execution result 1573.

パス名1571には、生成元を特定する情報が設定される。例えば、パス名「P1-Q1-Q1」は、当該ルールが、ループ外パス情報153の「P1」と、ループ回数1回の特化ループ
内パス情報156の「Q1-Q1」に基づき生成されたことを示す。パス条件1572及びパ
ス実行結果1573には、前述した方法で生成された値が設定される。尚、本例では、「P1-Q2-Q1」、「P1-Q2-Q2」、「P2-Q2-Q1」、及び「P2-Q2-Q2」のレコードは、夫々「P1-Q1-Q1」、「P1-Q1-Q2」、「P2-Q1-Q1」、及び「P2-Q1-Q2」のレコードと重複するため、ルール生成部115は一方をS1516の処理で削除する。また「P1-Q1-Q2」、「P2-Q1-Q1」、及び「P2-Q1-Q2」についてはパス条件1713が充足不能であるため、ルール生成部115はこれらをS1516の処理で削除する。
In the path name 1571, information for specifying the generation source is set. For example, the path name “P1-Q1-Q1” is generated based on “P1” of the out-loop path information 153 and “Q1-Q1” of the in-loop path information 156 of one loop number. It shows that. In the pass condition 1572 and the pass execution result 1573, values generated by the above-described method are set. In this example, the records “P1-Q2-Q1”, “P1-Q2-Q2”, “P2-Q2-Q1”, and “P2-Q2-Q2” are “P1-Q1-Q1”, respectively. , “P1-Q1-Q2”, “P2-Q1-Q1”, and “P2-Q1-Q2”, the rule generator 115 deletes one of them in the process of S1516. Further, since the path condition 1713 cannot be satisfied for “P1-Q1-Q2”, “P2-Q1-Q1”, and “P2-Q1-Q2”, the rule generation unit 115 deletes them in the process of S1516. .

図18はループの上限回数が1回に指定されている場合のルール情報157の例である
。前述したように入出力処理部116は上限回数の指定をユーザから受け付ける。そして、ルール生成部115を実行することにより、ループ回数が0回、1回、・・・K-1回、K回の夫々の場合についてルール情報157を生成する。入出力処理部116は、ルール情報157からループ回数が0回からK回の場合のルールを取得し、出力装置55に出力(表示)する。同図に示す、ループ上限回数が1回の場合のルール情報157は、パス名157
1、パス条件1572、及びパス実行結果1573の各項目を含む3つのレコードで構成されている。尚、パス名1571に設定されているルール「P1-Q1」、「P2-Q1」、及び「P1-Q1-Q1」は、図16に示したルール情報157及び図17に示したルール情報157から、図15のS1516の処理にて「P1-Q2」、「P2-Q2」、「P1-Q2-Q1」、「P1-Q2-Q2」、「P2-Q2-Q1」、「P2-Q2-Q2」、「P1-Q1-Q2」、「P2-Q1-Q1」、及び「P2-Q1-Q2」を削除し、削除後に残ったルールを集約した結果である。
FIG. 18 shows an example of the rule information 157 when the upper limit number of loops is designated as one. As described above, the input / output processing unit 116 receives designation of the upper limit number from the user. Then, by executing the rule generation unit 115, the rule information 157 is generated for each of the cases where the number of loops is 0 times, 1 time,... K-1 times, and K times. The input / output processing unit 116 acquires a rule when the number of loops is 0 to K from the rule information 157 and outputs (displays) the rule to the output device 55. The rule information 157 when the upper limit number of loops shown in FIG.
1, and includes three records including items of a path condition 1572 and a path execution result 1573. The rules “P1-Q1”, “P2-Q1”, and “P1-Q1-Q1” set in the path name 1571 are the rule information 157 shown in FIG. 16 and the rule information 157 shown in FIG. From “P1-Q2”, “P2-Q2”, “P1-Q2-Q1”, “P1-Q2-Q2”, “P2-Q2-Q1”, “P2-Q2” in the process of S1516 in FIG. -Q2 "," P1-Q1-Q2 "," P2-Q1-Q1 ", and" P2-Q1-Q2 "are deleted, and the rules remaining after the deletion are aggregated.

尚、ループ上限回数が1回の場合のルール情報157を得るためにはルール情報157
を生成する必要があるが、既にループ上限回数を1回に設定して記号実行を行う前にルー
プ上限回数を0回に設定して記号実行を行っていた場合等、既にルール情報157が生成
済みである場合には改めてルール情報157を生成する必要がない。そのため、ルール生成部115は、予めループ上限回数0回の場合のルールがルール情報157に格納されて
いるかを確認し、上記ルールが格納されていない場合にのみルール情報157を生成すればよい。
In order to obtain the rule information 157 when the loop upper limit number is 1, the rule information 157
However, the rule information 157 has already been generated, for example, when the symbol has been executed with the loop upper limit set to 0 before executing the symbol execution with the loop upper limit set to 1. If it is already completed, there is no need to generate the rule information 157 again. For this reason, the rule generation unit 115 may check in advance whether the rule for the loop upper limit count 0 is stored in the rule information 157 and generate the rule information 157 only when the rule is not stored.

以上に説明したように、仕様分析装置100は、ループ文を含むソースコードからルールを再生するにあたり、ループ文に対するパス実行結果を、ループをn-1回実行後の変数
の値とループをn回実行後の変数の値の関係式として記憶する。そのため、例えば、ルー
プ回数がK-1回の場合のルールが再生済みである場合、上記関係式と上記ループ回数がK-1回の場合のルールを生成する過程で生成したパスの情報に基づき、記号実行を行うことなく、簡単な代入処理や論理演算処理によってループ回数がK回の場合のルールを生成する
ことができる。即ち、一度の記号実行で生成した上記関係式を再帰的に用いることで、記号実行を繰り返し行うことなく、簡単な代入処理及び論理演算処理で、任意のループ回数におけるルールを生成することができる。そのため、記号実行にかかる計算機のリソースの消費を抑えることができるとともに、ルールを取得するまでに要する時間を短縮することができる。
As described above, the specification analysis apparatus 100, when reproducing the rule from the source code including the loop statement, displays the path execution result for the loop statement, the variable value after executing the loop n-1 times, and the loop n It is stored as a relational expression of variable values after the first execution. Therefore, for example, when the rule when the loop count is K-1 has been reproduced, based on the above relational expression and the path information generated in the process of generating the rule when the loop count is K-1 Without executing symbol execution, it is possible to generate a rule when the number of loops is K by simple substitution processing or logical operation processing. In other words, by recursively using the above relational expression generated in a single symbol execution, a rule for any number of loops can be generated by simple substitution processing and logical operation processing without repeating symbol execution. . For this reason, it is possible to suppress the consumption of computer resources for symbol execution, and it is possible to reduce the time required to acquire the rule.

また仕様分析装置100は、記号実行によって生成したルールを記憶するため、ループ上限回数を変更して複数回の記号実行を行う場合の処理量を削減することができる。例えば、ループ上限回数をL回にして記号実行を行った場合にはループ回数が0回からL回まで
の夫々に対応するルールが生成されて記憶され、例えば、その後にループ上限回数をL+1
回に変更して再度記号実行を行う場合は、ループ回数がL+1回の場合のルールのみを新規
に生成し、ループ回数0回からL回までのルールに追加すればよく、記号実行にかかる計算機のリソースの消費を抑えることができ、ルールを取得するまでに要する時間を短縮することができる。
Further, since the specification analysis apparatus 100 stores the rules generated by the symbol execution, it is possible to reduce the processing amount when the symbol execution is performed a plurality of times by changing the loop upper limit count. For example, when symbol execution is performed with the loop upper limit count set to L times, rules corresponding to each of the loop count from 0 to L times are generated and stored.For example, after that, the loop upper limit count is set to L + 1
If you want to execute the symbol again after changing to the number of times, you only need to create a new rule for the loop count L + 1 and add it to the rule for the loop count from 0 to L times. The consumption of the resources of the computer can be suppressed, and the time required to acquire the rule can be shortened.

このように本実施形態の仕様分析装置100によれば、任意のループ文を含むソースコードについての記号実行を効率よく行うことができる。
[第2実施形態]
As described above, according to the specification analyzing apparatus 100 of the present embodiment, symbol execution can be efficiently performed on source code including an arbitrary loop sentence.
[Second Embodiment]

図19は第2実施形態として説明する仕様分析装置100の機能ブロック図である。第2実施形態の仕様分析装置100も第1実施形態の仕様分析装置100と同様のハードウェアによって実現される。   FIG. 19 is a functional block diagram of the specification analysis apparatus 100 described as the second embodiment. The specification analysis apparatus 100 of the second embodiment is also realized by the same hardware as the specification analysis apparatus 100 of the first embodiment.

第2実施形態の仕様分析装置100は、第1実施形態の仕様分析装置100と同等の機能を備え、ループ内パス一般項化部121及び一般項化ルール生成部122の各機能をさらに備える。また第2実施形態の仕様分析装置100の情報記憶部110は、第1実施形態の情報記憶部110と同様の情報を記憶するとともに、さらに一般項化ループ内パス情報161及び一般項化ルール情報162を記憶する。   The specification analysis apparatus 100 according to the second embodiment includes functions equivalent to those of the specification analysis apparatus 100 according to the first embodiment, and further includes the functions of the in-loop path generalization unit 121 and the generalization rule generation unit 122. The information storage unit 110 of the specification analysis apparatus 100 according to the second embodiment stores the same information as the information storage unit 110 according to the first embodiment, and further includes generalized loop path information 161 and generalized rule information. 162 is stored.

ループ内パス一般項化部121は、汎化ループ内パス情報155を一般項化することにより一般項化ループ内パス情報161を生成する。一般項化ルール生成部122は、ループ外パス情報153及び一般項化ループ内パス情報161に基づき一般項で表現されたルールを生成し、生成したルールを一般項化ルール情報162として記憶する。   The in-loop path generalization unit 121 generates the generalized loop path information 161 by generalizing the generalized loop path information 155. The generalization rule generation unit 122 generates a rule expressed in a general term based on the out-of-loop path information 153 and the generalized in-loop path information 161, and stores the generated rule as generalization rule information 162.

入出力処理部116は、一般項化ルール情報162を出力装置55に出力(表示)する。また、入出力処理部116は、一般項化ルール情報162を、入力装置54や通信装置56を介して取得したループ上限回数にインスタンス化して出力(表示)する。   The input / output processing unit 116 outputs (displays) the generalization rule information 162 to the output device 55. Further, the input / output processing unit 116 instantiates and outputs (displays) the generalization rule information 162 to the loop upper limit number acquired via the input device 54 or the communication device 56.

続いて、図20に示すソースコード151を例として、第2実施形態の仕様分析装置100の具体的な動作について説明する。同図に示すように、ソースコード151はC言語で記述されており、ループ文302を含む。   Next, a specific operation of the specification analysis apparatus 100 according to the second embodiment will be described using the source code 151 illustrated in FIG. 20 as an example. As shown in the figure, the source code 151 is written in C language and includes a loop statement 302.

図21は、ループ外記号実行部112が、ループ外記述の記号実行に際して図20に示すソースコード151に基づき生成する探索木(以下、ループ外パス探索木2100と称する。)である。ループ外記号実行部112は、ループ外パス探索木2100を利用してループ外記号実行情報152を生成する。同図に示すように、ループ外パス探索木2100は、夫々「N0」〜「N7」のノード名が付与された8つのノードを有する。   FIG. 21 shows a search tree (hereinafter referred to as an out-of-loop path search tree 2100) generated by the outside-loop symbol execution unit 112 based on the source code 151 shown in FIG. The out-of-loop symbol execution unit 112 uses the out-of-loop path search tree 2100 to generate out-of-loop symbol execution information 152. As shown in the figure, the out-loop path search tree 2100 has eight nodes assigned node names “N0” to “N7”, respectively.

上記8つのノードのうち、ノード名が「N0」のノードは図21のソースコード151の1行目の記述に対応し、ソースコード151の開始点を意味する「START」という手続き
を含む。またノード名が「N1」のノードは、図21に示すソースコード151の2行目の記述に対応し、「z=0」という手続きを含む。またノード名が「N2」のノードは、図21
に示すソースコード151の3〜6行目の記述、即ちループ文302に対応している。ノード名が「N3」のノードは、図21に示すソースコード151の7行目に対応している。当該行には「if (x % 2 == 0) {」という条件分岐の記述がされており、ループ外記号実
行部112は、当該行を分岐点として、条件が「True」の場合と「False」の場合の2通
りのパスを探索する。尚、以下の説明において、これら2つのパスの夫々にパス名として「P1」,「P2」を付与する。
Of the above eight nodes, the node whose node name is “N0” corresponds to the description of the first line of the source code 151 in FIG. 21 and includes a procedure “START” which means the start point of the source code 151. The node whose node name is “N1” corresponds to the description on the second line of the source code 151 shown in FIG. 21 and includes a procedure “z = 0”. The node whose node name is “N2” is shown in FIG.
3 corresponds to the description of the third to sixth lines of the source code 151 shown in FIG. The node whose node name is “N3” corresponds to the seventh line of the source code 151 shown in FIG. A conditional branch of “if (x% 2 == 0) {” is described in the line, and the out-of-loop symbol execution unit 112 uses the line as a branch point and the condition is “True” and “ Two paths in the case of “False” are searched. In the following description, “P1” and “P2” are given to each of these two paths as path names.

図22及び図23は、図21のループ外パス探索木2100に基づきループ外記号実行部112が生成するループ外記号実行情報152である。このうち図22に示すループ外
記号実行情報152は、パス名が「P1」のパスに対応し、一方、図23に示すループ外記号実行情報152は、パス名が「P2」のパスに対応する。
22 and 23 show the out-of-loop symbol execution information 152 generated by the out-of-loop symbol execution unit 112 based on the out-of-loop path search tree 2100 of FIG. Of these, the out-of-loop symbol execution information 152 shown in FIG. 22 corresponds to the path whose path name is “P1”, while the out-of-loop symbol execution information 152 shown in FIG. 23 corresponds to the path whose path name is “P2”. To do.

図24は、ループ外記号実行部112が生成するループ外パス情報153である。パス終端ノード1532には、当該パスの終端ノードのノード名が設定される。図4に示すループ外パス探索木の場合はノード名が「N5」、「N7」のノードが終端ノードとなる。   FIG. 24 shows the out-of-loop path information 153 generated by the out-of-loop symbol execution unit 112. In the path termination node 1532, the node name of the termination node of the path is set. In the case of the out-loop path search tree shown in FIG. 4, nodes with node names “N5” and “N7” are terminal nodes.

図25は、ループ内記号実行部113が、ループ文302について記号実行を行う際に生成する探索木(以下、ループ内パス探索木2500と称する。)である。ループ内記号実行部113は、ループ内パス探索木2500を利用してループ外記号実行情報152を生成する。同図に示すように、ループ内パス探索木2500は、夫々「M0」〜「M4」のノード名が付与された5つのノードを有する。   FIG. 25 is a search tree (hereinafter referred to as an in-loop path search tree 2500) generated when the in-loop symbol execution unit 113 executes symbol execution for the loop statement 302. The in-loop symbol execution unit 113 uses the in-loop path search tree 2500 to generate the out-loop symbol execution information 152. As shown in the figure, the in-loop path search tree 2500 has five nodes assigned node names “M0” to “M4”, respectively.

上記5つのノードのうち、ノード名が「M0」のノードは図20に示すソースコード151の3行目の記述に対応し、ソースコード151の開始点を意味する「START」という手
続きを含む。またノード名が「M1」のノードは、図20に示すソースコード151の3行目の記述に対応し、「while ( (3 * z) < x ) {」という条件(以下、ループ条件と称す
る。)の記述を含む。またノード名が「M2」のノードは、図20に示すソースコード151の4行目に対応している。またノード名が「M3」のノードは、図20に示すソースコード151の5行目に対応している。またノード名が「M4」のノードはパスの終端ノードに対応している。尚、以下の説明において、上記パスのパス名として「Q1」を付与する。
Of the above five nodes, the node whose node name is “M0” corresponds to the description of the third line of the source code 151 shown in FIG. 20 and includes a procedure “START” which means the starting point of the source code 151. The node whose node name is “M1” corresponds to the description on the third line of the source code 151 shown in FIG. 20 and is a condition “while ((3 * z) <x) {” (hereinafter referred to as a loop condition). .) Description. A node whose node name is “M2” corresponds to the fourth line of the source code 151 shown in FIG. A node whose node name is “M3” corresponds to the fifth line of the source code 151 shown in FIG. A node whose node name is “M4” corresponds to a terminal node of the path. In the following description, “Q1” is given as the path name of the above path.

図26は、図20のループ文302に基づき生成されるループ内記号実行情報154である。同図に示すループ内記号実行情報154は、ループ内記号実行部113により第1実施形態と同様の方法で生成される。   FIG. 26 shows in-loop symbol execution information 154 generated based on the loop statement 302 of FIG. The in-loop symbol execution information 154 shown in the figure is generated by the in-loop symbol execution unit 113 in the same manner as in the first embodiment.

図27は図20のループ文302に基づき生成される汎化ループ内パス情報155である。同図に示す汎化ループ内パス情報155は、ループ内記号実行部113により第1実施形態と同様の方法で生成される。   FIG. 27 shows generalized loop path information 155 generated based on the loop statement 302 of FIG. The generalized in-loop path information 155 shown in the figure is generated by the in-loop symbol execution unit 113 in the same manner as in the first embodiment.

図28は、汎化ループ内パス情報155に基づきループ内パス一般項化部121が生成する一般項化ループ内パス情報161である。同図に示すように、一般項化ループ内パス情報161は、パス名1611、パス終端ノード1612、初項1613、パス条件1614、及び一般項1615の各項目を有する一つ以上のレコードで構成されている。ループ内パス一般項化部121は、汎化ループ内パス情報155の変数状態1555を漸化式とみなしてその一般項を求める。尚、漸化式からその一般項を求める方法としては、例えば、非特許文献1の第10章に記載されている方法がある。   FIG. 28 shows generalized loop internal path information 161 generated by the internal loop path generalization unit 121 based on the generalized loop internal path information 155. As shown in the drawing, the path information 161 in the generalized loop is composed of one or more records each having items of a path name 1611, a path end node 1612, an initial term 1613, a path condition 1614, and a general term 1615. Has been. The in-loop path generalization unit 121 obtains the general term by regarding the variable state 1555 of the generalized loop path information 155 as a recurrence formula. As a method for obtaining the general term from the recurrence formula, for example, there is a method described in Chapter 10 of Non-Patent Document 1.

図29は、ループ外パス情報153及び一般項化ループ内パス情報161に基づき一般項化ルール生成部122が生成する一般項化ルール情報162である。一般項化ルール生成部122は、一般項化ループ内パス情報161とループ外パス情報153とを組合せることにより一般項化ルール情報162を生成する。本例の場合、一般項化ルール生成部122は2つの一般項化ルールを生成する。   FIG. 29 shows the generalization rule information 162 generated by the generalization rule generation unit 122 based on the out-loop path information 153 and the generalization loop path information 161. The generalization rule generation unit 122 generates generalization rule information 162 by combining the generalization loop path information 161 and the out-loop path information 153. In this example, the generalization rule generation unit 122 generates two generalization rules.

まず一般項化ルール生成部122は、ループ外パス情報153のパス条件1533に基づき一般項化ルール情報162のパス条件1622を生成する。一般項化ルール生成部122は、ループ外パス情報153のパス条件1533に現れるループ実行後の変数の値を表すシンボル値を、ループ実行前の変数の値を表すシンボル値を含む式に置換する。さらに、一般項化ルール生成部122は、ループ前変数状態1534に基づき、上記ループ実行前の変数の値を表すシンボル値を、当該変数が実際に保持する値に置換する。   First, the generalization rule generation unit 122 generates a path condition 1622 of the generalization rule information 162 based on the path condition 1533 of the out-of-loop path information 153. The generalization rule generation unit 122 replaces the symbol value representing the value of the variable after loop execution appearing in the path condition 1533 of the out-of-loop path information 153 with an expression including the symbol value representing the value of the variable before loop execution. . Further, based on the pre-loop variable state 1534, the generalization rule generation unit 122 replaces the symbol value representing the value of the variable before the loop execution with a value actually held by the variable.

例えば、ループ外パス情報153のパス名1531が「P1」のパスと、一般項化ループ内パス情報161のパス名1611が「Q1」のパスに基づきパス条件を生成する場合を考える。図24に示すように、ループ外パス情報153のパス条件1533は「AL_x % 2 == 0」である。ここで、パス条件1533におけるループ実行後の変数の値「AL_x」は図
28の一般項化ループ内パス情報161の一般項1615の「xn」に一致することに注目する。そして上記「xn」の値は、一般項1615より「xn=x0+2*n」であること、及び初
項1613より「x0=BL_x」であることから、一般項化ルール生成部122は、上記パス
条件1533を「(BL_x + 2*n) % 2 == 0」に変換する。またループ前変数状態1534
より「BL_x == X」であるため、これに基づき一般項化ルール生成部122は「(X + 2*n)
% 2 == 0」を生成する。
For example, consider a case in which a path condition is generated based on a path whose path name 1531 of the out-of-loop path information 153 is “P1” and a path whose path name 1611 of the generalized loop path information 161 is “Q1”. As shown in FIG. 24, the path condition 1533 of the out-of-loop path information 153 is “AL_x% 2 == 0”. Here, note that the variable value “AL_x” after loop execution in the path condition 1533 matches “x n ” of the general term 1615 of the generalized loop internal path information 161 of FIG. Since the value of “x n ” is “x n = x 0 + 2 * n” from the general term 1615 and “x 0 = BL_x” from the first term 1613, the generalization rule generation The unit 122 converts the path condition 1533 into “(BL_x + 2 * n)% 2 == 0”. Also, variable state before loop 1534
Since “BL_x == X”, based on this, the generalization rule generation unit 122 “(X + 2 * n)
% 2 == 0 ”is generated.

続いて、一般項化ルール生成部122は、ループ外パス情報153の変数状態1535と、一般項化ループ内パス情報161の一般項1615から、一般項化ルール情報162のパス実行結果1623を生成する。具体的には、一般項化ルール生成部122は、ループ外パス情報153の変数状態1535に現れるループ実行後の変数の値を表すシンボル値を、ループ実行前の変数の値を表すシンボル値に置換する。さらに一般項化ルール生成部122は、ループ外パス情報153のループ前変数状態1534に基づき、上記ループ実行前の変数の値を表すシンボル値を、当該変数が実際に保持する値に置換する。   Subsequently, the generalization rule generation unit 122 generates a path execution result 1623 of the generalization rule information 162 from the variable state 1535 of the outside-loop path information 153 and the general term 1615 of the generalization loop internal path information 161. To do. Specifically, the generalization rule generation unit 122 converts the symbol value representing the value of the variable after loop execution appearing in the variable state 1535 of the out-of-loop path information 153 to the symbol value representing the value of the variable before loop execution. Replace. Furthermore, based on the pre-loop variable state 1534 of the out-of-loop path information 153, the generalization rule generation unit 122 replaces the symbol value representing the value of the variable before the loop execution with a value actually held by the variable.

例えば、ループ外パス情報153のパス名1531が「P1」のパスと、一般項化ループ内パス情報161のパス名1611が「Q1」パスとに基づき一般項化ルール情報162のパス実行結果1623を生成する場合を考える。ここでループ外パス情報153の変数状態1535は「x=AL_x」、一般項化ループ内パス情報161の一般項1615は「xn=x0+2*n」である。上述のとおり「AL_x」は「xn」に一致すること、及び初項1613より「x0=BL_x」であることから、一般項化ルール生成部122は「x=BL_x + 2*n」を得る。そして、一般項化ルール生成部122は、ループ外パス情報153のループ前変数状態1534に基づき「x=X + 2*n」を得る。同様の方法により「z=X + 2*n」が得られる。ここで図20に示したソースコード151において戻り値として返す変数の値のみ、ルールのパス実行結果として採用するものとすれば、一般項化ルール生成部122は、ソースコード151の12行目に基づき、変数zの値を表す「z=X + 2*n」をパス実行結果として採用する。 For example, the path execution result 1623 of the generalized rule information 162 is based on the path whose path name 1531 of the out-of-loop path information 153 is “P1” and the path name 1611 of the path information 161 of the generalized loop information 161 is “Q1”. Consider the case of generating Here, the variable state 1535 of the out-of-loop path information 153 is “x = AL_x”, and the general term 1615 of the generalized in-loop path information 161 is “x n = x 0 + 2 * n”. As described above, since “AL_x” matches “x n ” and “x 0 = BL_x” from the first term 1613, the general termization rule generation unit 122 sets “x = BL_x + 2 * n”. obtain. Then, the generalization rule generation unit 122 obtains “x = X + 2 * n” based on the pre-loop variable state 1534 of the out-loop path information 153. “Z = X + 2 * n” is obtained by the same method. Here, if only the value of the variable returned as the return value in the source code 151 shown in FIG. 20 is adopted as the rule path execution result, the generalization rule generation unit 122 reads the 12th line of the source code 151. Based on this, “z = X + 2 * n” representing the value of the variable z is adopted as the pass execution result.

続いて、一般項化ルール生成部122は、汎化ループ内パス情報155のパス条件1554に基づき、一般項化ルール情報162におけるループ回数nの制約条件1624を生
成する。まず一般項化ルール生成部122は、パス条件1554に含まれるループの実行回数がn回における変数の値を、一般項化ループ内パス情報161の一般項1615に置
換する。さらに一般項化ルール生成部122は、一般項化ループ内パス情報161の初項1613及びループ外パス情報153のループ前変数状態1534に基づき、シンボル値の置換を行う。
Subsequently, the generalization rule generation unit 122 generates a constraint condition 1624 for the number of loops n in the generalization rule information 162 based on the path condition 1554 of the generalized loop path information 155. First, the generalization rule generation unit 122 replaces the value of the variable when the number of loop executions included in the path condition 1554 is n times with the general term 1615 of the generalization loop internal path information 161. Furthermore, the generalization rule generation unit 122 performs symbol value replacement based on the first term 1613 of the generalized in-loop path information 161 and the pre-loop variable state 1534 of the out-of-loop path information 153.

例えば、一般項化ルール生成部122が、ループ外パス情報153のパス名1531が「P1」のパスと、一般項化ループ内パス情報161のパス名1611が「Q1」のパスとに基づき、一般項化ルール情報162におけるループ回数nの制約条件1624を生成する
場合を考える。まず一般項化ルール生成部122は、一般項化ループ内パス情報161のパス条件1614の式「3 * (zn -1) < xn - 2(但しn>0) && !(3 * zn < xn) (但しn≧0)」を、一般項1615に基づき、「3 * ((z0 + n) -1) < (x0 + 2*n) - 2 (但しn>0) && !(3 * (z0 + n) < (x0 + 2*n)) (但しn≧0)」に変換する。そして一般項化ルール生成部
122は、初項1613に基づき、上記式を3 * ((BL_z + n) -1) < (BL_x + 2*n) - 2 (但しn>0) && !(3 * (BL_z + n) < (BL_x + 2*n)) (但しn≧0)」に変換する。さらに一般
項化ルール生成部122は、ループ前変数状態1534に基づき、上式を「3 * (n -1) <
X + 2*n - 2 (但しn>0) && !(3 * n < X + 2*n) (但しn≧0)」に変換する。
For example, based on the path whose path name 1531 of the out-of-loop path information 153 is “P1” and the path name 1611 of the path information 1611 in the generalized loop information 161 is “Q1”, Consider a case where the constraint condition 1624 for the number of loops n in the generalization rule information 162 is generated. First, the generalization rule generation unit 122 generates the expression “3 * (z n −1) <x n −2 (where n> 0) &&! (3 * z) of the path condition 1614 of the path information 161 in the generalization loop. n <x n ) (where n ≧ 0) ”, based on the general term 1615,“ 3 * ((z 0 + n) −1) <(x 0 + 2 * n) −2 (where n> 0) &&! (3 * (z 0 + n) <(x 0 + 2 * n)) (where n ≧ 0) ”. Then, the generalization rule generation unit 122 converts the above expression into 3 * ((BL_z + n) -1) <(BL_x + 2 * n) -2 (where n> 0) &&! (3 * (BL_z + n) <(BL_x + 2 * n)) (where n ≧ 0) ”. Further, the generalization rule generation unit 122 converts the above expression to “3 * (n −1) <based on the pre-loop variable state 1534.
X + 2 * n-2 (where n> 0) &&! (3 * n <X + 2 * n) (where n ≧ 0) ”.

図30は、入出力処理部116が、一般項化ルール情報162に基づき出力装置55に出力する、一般項化ルールを表示する画面の例(以下、一般項化ルール表示画面3000と称する。)である。   FIG. 30 shows an example of a screen that displays generalized rule that the input / output processor 116 outputs to the output device 55 based on the generalized rule information 162 (hereinafter referred to as a generalized rule display screen 3000). It is.

入出力処理部116は、同画面に設けられているループ上限回数の入力受付欄3010を介して、ユーザからループ上限回数の入力を受け付ける。また入出力処理部116は、同画面に設けられているルール展開実行ボタン3012が押下されると、一般項化ルール情報162に含まれるループ回数を表す変数nに0から上記ループ上限回数までの値を順次代入してその結果を取得する。   The input / output processing unit 116 receives an input of the loop upper limit count from the user via the loop upper limit count input receiving column 3010 provided on the same screen. When the rule expansion execution button 3012 provided on the same screen is pressed, the input / output processing unit 116 sets a variable n representing the number of loops included in the generalized rule information 162 from 0 to the above loop upper limit number. Substitute values sequentially to get the result.

例えば、一般項化ルール情報162に対して、ユーザがループ上限回数の入力受付欄3011に1を入力し、ルール展開実行ボタン3012を押下した場合、入出力処理部11
6は、まず一般項化ルール情報162の「P1-Q1」及び「P2-Q1」のnに0を代入することで、展開後ルール表示欄3013における「P1-Q1-0」及び「P2-Q1-0」の内容(一般項で表現されたルールを具体化した情報)を生成する。次に入出力処理部116は、「P1-Q1」
及び「P2-Q1」のnに1を代入することで、展開後ルール表示欄3013における「P1-Q1-1」及び「P2-Q1-1」の内容(一般項で表現されたルールを具体化した情報)を生成する。
For example, when the user inputs 1 into the loop upper limit count input reception field 3011 and presses the rule expansion execution button 3012 for the generalized rule information 162, the input / output processing unit 11
6. First, by substituting 0 for n of “P1-Q1” and “P2-Q1” of the generalization rule information 162, “P1-Q1-0” and “P2-Q2” in the expanded rule display column 3013 are displayed. The contents of “Q1-0” (information that embodies the rules expressed in general terms) are generated. Next, the input / output processing unit 116 reads “P1-Q1”.
And by substituting 1 for n in “P2-Q1”, the contents of “P1-Q1-1” and “P2-Q1-1” in the expanded rule display field 3013 (specify the rules expressed in the general terms) Information).

一般項化ルール情報162におけるループ回数nの制約条件1624は、展開後ルール
表示欄3013における制約条件3014に基づき生成される。入出力処理部116は、パス条件3015に基づき制約条件3014の論理積について充足可能性を判定し、充足不能の場合には、そのルールを非表示あるいは強調表示(太枠表示、グレーアウト等)などとする。本例では「P1-Q1-1」が太枠表示されている。
The restriction condition 1624 for the number of loops n in the generalized rule information 162 is generated based on the restriction condition 3014 in the expanded rule display field 3013. Based on the path condition 3015, the input / output processing unit 116 determines whether or not the logical product of the constraint conditions 3014 is satisfiable, and if it cannot be satisfied, the rule is hidden or highlighted (bold frame display, grayout, etc.), etc. And In this example, “P1-Q1-1” is displayed in a thick frame.

このように第2実施形態の仕様分析装置100は、汎化ループ内パス情報を表現した漸化式の一般項を求めることにより、ループ文をn回実行した場合における変数の値と上記nを含む式との関係式である一般項化ループ内パス情報161を生成し、一般項化ループ内パス情報161とループ外パス情報153とに基づき、一般項で表現されたルールである一般項化ルール情報を生成するので、ユーザが利用しやすい形でソフトウェアの仕様(ルール)に関する情報を提供することができる。   As described above, the specification analyzing apparatus 100 according to the second embodiment obtains the general term of the recurrence formula expressing the path information in the generalized loop, thereby obtaining the value of the variable and the above n when the loop statement is executed n times. A general termization loop path information 161 that is a relational expression with the containing expression is generated, and a general termization that is a rule expressed by a general term based on the general termization loop inner path information 161 and the out-loop path information 153 is generated. Since the rule information is generated, it is possible to provide information related to software specifications (rules) in a form that is easy for the user to use.

ところで、本発明は上記の実施形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。例えば、上記の実施形態は本発明を分かりやすく説明するために詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに限定されるものではない。また上記実施形態の構成の一部について、他の構成の追加・削除・置換をすることが可能である。   By the way, it goes without saying that the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the scope of the invention. For example, the above embodiment has been described in detail for easy understanding of the present invention, and is not necessarily limited to the one having all the configurations described. In addition, it is possible to add, delete, and replace other configurations for a part of the configuration of the above embodiment.

例えば、任意のKについて、ループ回数がK-1回の場合のルールとループ回数がK回の場
合のルールとを比較した場合、例えば、係数の値が規則的に増加もしくは減少する等、ルールの間に一定の規則性を見いだせることがある。またその場合、ループの実行回数が実際の(予め想定されている)ループの最大実行回数を超えた場合に上記規則性の逸脱が見られることがある。そこで、例えば、ルール生成部115が、ループ回数0回の場合のル
ール、1回の場合のルール、・・・K-1回の場合のルール、K回の場合のルール、K+1回の場合のルール、・・・と継続的にルールを監視し、上記規則性の逸脱を検知した場合に自動的にユーザに警告等の情報を出力するようにする。これによりユーザは実際のループの最大実行回数を容易かつ精度よく把握することができる。尚、上記規則性を検出する方法としては、例えば、上記ルールを構成している数字や演算子に関する情報を抽出し、それら
の情報を機械学習のアルゴリズムを活用して分類するという方法がある。
For example, for an arbitrary K, when comparing the rule when the number of loops is K-1 with the rule when the number of loops is K, for example, the rule is such that the coefficient value increases or decreases regularly. Some regularity can be found during the period. In that case, the deviation of the regularity may be seen when the number of loop executions exceeds the actual (preliminarily assumed) maximum number of loop executions. Therefore, for example, the rule generation unit 115 has a rule for when the number of loops is 0, a rule for 1 time, a rule for K-1 times, a rule for K times, a K + 1 time rule, The rules are continuously monitored, and information such as a warning is automatically output to the user when a deviation from the regularity is detected. As a result, the user can easily and accurately grasp the maximum number of executions of the actual loop. As a method of detecting the regularity, for example, there is a method of extracting information on numbers and operators constituting the rule and classifying the information by using a machine learning algorithm.

また例えば、ソースコードに複数のループ文が含まれている場合、仕様分析装置100が、ループ文ごとにループ上限回数の指定を受け付け、ループ文ごとに、情報記憶部110が記憶している特化ループ内パス情報156のうちループ回数が最大のものを取得し、ループ文ごとに、取得した特化ループ内パス情報156に汎化ループ内パス情報155を再帰的に適用することによりループの上限回数までの特化ループ内パス情報156を生成するようにしてもよい。   For example, when a plurality of loop statements are included in the source code, the specification analysis apparatus 100 accepts designation of the upper limit number of loops for each loop statement, and the information storage unit 110 stores the feature number for each loop statement. The path information 156 having the maximum number of loops is acquired from the path information 156 in the generalized loop, and for each loop statement, the path information 155 in the generalized loop is recursively applied to the acquired path information 156 in the specialized loop. The path information 156 in the special loop up to the upper limit number may be generated.

図31は、入出力処理部116が出力装置55に出力(表示)するループ上限回数の指定画面3100の例である。ループ上限回数の指定画面3100は、ソースコード表示欄3111と、ループ上限回数登録欄3112とを含む。ループ上限回数登録欄3112は、ループ文位置特定結果3113、ループ上限回数入力受付部3114、ループ上限回数一括入力受付部3115、ループ上限回数一括設定ボタン3116、ループ文抽出ボタン3117、及びループ上限回数登録ボタン3118を含む。   FIG. 31 shows an example of a designation screen 3100 for specifying the upper limit number of loops that the input / output processing unit 116 outputs (displays) to the output device 55. The loop upper limit count designation screen 3100 includes a source code display field 3111 and a loop upper limit count registration field 3112. The loop upper limit count registration field 3112 includes a loop sentence position specifying result 3113, a loop upper limit count input receiving unit 3114, a loop upper limit count batch input receiving unit 3115, a loop upper limit count batch setting button 3116, a loop sentence extracting button 3117, and a loop upper limit count. A registration button 3118 is included.

まず入出力処理部116は、ソースコードを取得し、ソースコード表示欄3111に表示する。ユーザがループ文抽出ボタン3117を押下すると、入出力処理部116は、上記ソースコードを参照し、ループ文の位置を特定する。本実施例では、ループ文3151及び3152の夫々の開始行及び終了行を特定する。そして、入出力処理部116は、上記ループ文3151及び3152の開始行及び終了行を、ループ文位置特定結果3113に表示する。   First, the input / output processing unit 116 acquires the source code and displays it in the source code display field 3111. When the user presses the loop sentence extraction button 3117, the input / output processing unit 116 refers to the source code and specifies the position of the loop sentence. In this embodiment, the start and end lines of the loop statements 3151 and 3152 are specified. Then, the input / output processing unit 116 displays the start and end lines of the loop statements 3151 and 3152 in the loop statement position specifying result 3113.

ユーザは、ループ文位置特定結果3113に示されている各ループ文のループ上限回数を、夫々に対応するループ上限回数入力受付部3114に入力する。またユーザは、ループ上限回数一括入力受付部3115に全ループ文に適用するループ上限回数を入力し、ループ上限回数一括設定ボタン3116を押下することで、ループ上限回数入力受付部3114に同じ値を(各ループ文に同じ上限回数を)一括設定することもできる。   The user inputs the loop upper limit number of each loop sentence shown in the loop sentence position specifying result 3113 to the corresponding loop upper limit number input receiving unit 3114. In addition, the user inputs the loop upper limit number to be applied to all loop statements to the loop upper limit number batch input receiving unit 3115 and presses the loop upper limit number batch setting button 3116, so that the same value is given to the loop upper limit number input receiving unit 3114. It is also possible to set all at once (the same upper limit for each loop statement).

以上のようにしてループ上限回数を入力した後、ユーザがループ上限回数登録ボタン3118を押下すると、入出力処理部116は、各ループ文に対するループ上限回数を取得する。   After the loop upper limit count is input as described above, when the user presses the loop upper limit count registration button 3118, the input / output processing unit 116 acquires the loop upper limit count for each loop sentence.

また上記の各構成、機能部、処理部、処理手段等は、それらの一部または全部を、例えば、集積回路で設計する等によりハードウェアで実現してもよい。また上記の各構成、機能等は、プロセッサがそれぞれの機能を実現するプログラムを解釈し、実行することによりソフトウェアで実現してもよい。各機能を実現するプログラム、テーブル、ファイル等の情報は、メモリやハードディスク、SSD(Solid State Drive)等の記録装置、また
はICカード、SDカード、DVD等の記録媒体に置くことができる。
Each of the above-described configurations, function units, processing units, processing means, and the like may be realized in hardware by designing some or all of them, for example, with an integrated circuit. Each of the above-described configurations, functions, and the like may be realized by software by the processor interpreting and executing a program that realizes each function. Information such as programs, tables, and files for realizing each function can be stored in a recording device such as a memory, a hard disk, or an SSD (Solid State Drive), or a recording medium such as an IC card, an SD card, or a DVD.

また上記の各図において、制御線や情報線は説明上必要と考えられるものを示しており、必ずしも実装上の全ての制御線や情報線を示しているとは限らない。例えば、実際にはほとんど全ての構成が相互に接続されていると考えてもよい。   Further, in each of the above drawings, control lines and information lines indicate what is considered necessary for explanation, and not all control lines and information lines on the mounting are necessarily shown. For example, it may be considered that almost all configurations are actually connected to each other.

また以上に説明した仕様分析装置100の各種機能部、各種処理部、各種データベースの配置形態は一例に過ぎない。各種機能部、各種処理部、各種データベースの配置形態は、仕様分析装置100が備えるハードウェアやソフトウェアの性能、処理効率、通信効率等の観点から最適な配置形態に変更し得る。   Moreover, the arrangement | positioning form of the various function parts of the specification analyzer 100 demonstrated above, various process parts, and various databases is only an example. The arrangement form of the various functional units, the various processing units, and the various databases can be changed to an optimum arrangement form from the viewpoint of the performance of hardware and software provided in the specification analysis apparatus 100, processing efficiency, communication efficiency, and the like.

また前述したデータベースの構成(スキーマ(Schema)等)は、リソースの効率的な利
用、処理効率向上、アクセス効率向上、検索効率向上等の観点から柔軟に変更し得る。
The database configuration (schema) described above can be flexibly changed from the viewpoints of efficient use of resources, improvement of processing efficiency, improvement of access efficiency, improvement of search efficiency, and the like.

100 仕様分析装置、110 情報記憶部、111 ループ文特定部、112 ループ外記号実行部、113 ループ内記号実行部、114 ループ内パス特化部、115 ルール生成部、116 入出力処理部116 入出力処理部、121 ループ内パス一般項化部、122 一般項化ルール生成部、151 ソースコード、152 ループ外記号実行情報、153 ループ外パス情報、154 ループ内記号実行情報、155 汎化ループ内パス情報、156 ループ外パス情報、157 ルール情報、161 一般項化ループ内パス情報、162 一般項化ルール情報、301 ループ文、302 ループ文、400 ループ外パス探索木、
800 ループ内パス探索木、3000 一般項化ルール表示画面、S1200 ループ内パス特化処理、S1500 ルール生成処理
100 specification analyzer, 110 information storage unit, 111 loop sentence specifying unit, 112 out-of-loop symbol execution unit, 113 in-loop symbol execution unit, 114 in-loop path specialization unit, 115 rule generation unit, 116 input / output processing unit 116 Output processing unit, 121 In-loop path generalization unit, 122 Generalization rule generation unit, 151 Source code, 152 Out-of-loop symbol execution information, 153 Out-of-loop path information, 154 In-loop symbol execution information, 155 In generalized loop Path information, 156 Out-of-loop path information, 157 Rule information, 161 Generalized looped path information, 162 Generalized ruled information, 301 Loop sentence, 302 Loop sentence, 400 Outer loop path search tree,
800 In-loop path search tree, 3000 Generalized rule display screen, S1200 In-loop path specialization process, S1500 rule generation process

Claims (10)

ソフトウェアの仕様を分析する装置であって、
分析対象のソフトウェアを実現するプログラムのソースコードを記憶する記憶部と、
前記ソースコードに含まれているループ文の記述を特定するループ文特定部と、
特定した前記ループ文以外の前記ソースコードの記述について記号実行を行うことにより、前記ソースコードのパス条件及びパス実行結果を含む情報であるループ外パス情報を、前記ループ文の実行前における変数の値と前記ループ文の実行後における変数の値とを用いて生成するループ外記号実行部と、
特定した前記ループ文について記号実行を行うことにより、前記ソースコードに含まれている各変数について、前記ループ文をn−1回実行した後における当該変数の値と、前記ループ文をn回実行した後における当該変数の値との関係を示す情報である汎化ループ内パス情報を生成する、ループ内記号実行部と、
ループを特定回数実行した場合における前記ソースコードのパスに関する情報である特化ループ内パス情報を生成するループ内パス特化部と、
前記ループ内パス特化部が生成した前記特化ループ内パス情報のうち、任意回数だけループを実行した場合における変数の値を含む第1の特化ループ内パス情報を取得し、前記第1の特化ループ内パス情報に前記汎化ループ内パス情報を適用することにより、前記第1の特化ループ内パス情報よりもループ回数が1つ大きい第2の特化ループ内パス情報を生成し、前記第2の特化ループ内パス情報と前記ループ外パス情報とに基づき、前記ソフトウェアの仕様を表すルールを含む情報であるルール情報を生成するルール生成部、
を備える、ソフトウェア仕様分析装置。
A device for analyzing software specifications,
A storage unit that stores a source code of a program that realizes software to be analyzed;
A loop statement specifying unit for specifying a description of a loop statement included in the source code;
By performing symbol execution on the description of the source code other than the identified loop statement, path information outside the loop, which is information including the path condition of the source code and the path execution result, is stored in the variable before the execution of the loop statement. An out-of-loop symbol execution unit that generates a value and a value of a variable after execution of the loop statement;
By executing symbol execution for the identified loop statement, for each variable included in the source code, the value of the variable after executing the loop statement n-1 times and the loop statement n times An in-loop symbol execution unit that generates path information in the generalized loop that is information indicating a relationship with the value of the variable after
An in-loop path specialization unit that generates path information in a special loop that is information on the path of the source code when the loop is executed a specific number of times;
Among the path information in the special loop generated by the path specialization unit in the loop, first path information in the special loop including a variable value when the loop is executed an arbitrary number of times is acquired, and the first By applying the generalized loop path information to the specialized loop path information, the second specialized loop path information whose number of loops is one greater than the first specialized loop path information is generated. A rule generation unit that generates rule information that is information including a rule representing the software specifications based on the second specialized loop path information and the non-loop path information;
A software specification analyzer comprising:
請求項1に記載のソフトウェア仕様分析装置であって、
前記ループ内パス特化部が生成した前記特化ループ内パス情報を記憶する記憶部を備え、
前記ルール生成部は、ループの上限回数の指定を受け付け、前記記憶部が記憶している前記特化ループ内パス情報のうちループ回数が最大のものを取得し、取得した前記特化ループ内パス情報に前記汎化ループ内パス情報を再帰的に適用することにより前記ループ上限回数までの前記特化ループ内パス情報を生成し、生成した前記特化ループ内パス情報と前記ループ外パス情報とを用いて前記ルールを生成する、
ソフトウェア仕様分析装置。
The software specification analyzer according to claim 1,
A storage unit for storing the path information in the specialized loop generated by the path specializing unit in the loop;
The rule generation unit accepts designation of the upper limit number of loops, acquires the specialized loop path information stored in the storage unit and has the maximum number of loops, and acquires the acquired specialized loop path By recursively applying the generalized loop path information to the information to generate the specialized loop path information up to the upper limit number of loops, the generated specialized loop path information and the out-of-loop path information, Generate the rule using
Software specification analyzer.
請求項1に記載のソフトウェア仕様分析装置であって、
前記ルール生成部は、前記ソースコードに含まれているループ文ごとにループの上限回数の指定を受け付け、前記ループ文ごとに、前記記憶部が記憶している前記特化ループ内パス情報のうちループ回数が最大のものを取得し、前記ループ文ごとに、取得した前記特化ループ内パス情報に前記汎化ループ内パス情報を再帰的に適用することにより前記ループの上限回数までの前記特化ループ内パス情報を生成する、
ソフトウェア仕様分析装置。
The software specification analyzer according to claim 1,
The rule generation unit receives designation of the upper limit number of loops for each loop statement included in the source code, and for each loop statement, out of the specialized loop path information stored in the storage unit The loop having the maximum number of loops is acquired, and the path information in the generalized loop is recursively applied to the acquired path information in the specialized loop for each loop statement, so that the special number up to the upper limit number of loops is obtained. Generate path information in the optimization loop,
Software specification analyzer.
請求項1に記載のソフトウェア仕様分析装置であって、
前記汎化ループ内パス情報を表現した漸化式の一般項を求めることにより、前記ループ文をn回実行した場合における前記変数の値と、前記nを含む式との関係式である一般項化ループ内パス情報を生成するループ内パス一般項化部と、
前記一般項化ループ内パス情報と前記ループ外パス情報とに基づき、一般項で表現されたルールである一般項化ルール情報を生成する、一般項化ルール生成部と、
をさらに備える、ソフトウェア仕様分析装置。
The software specification analyzer according to claim 1,
A general term that is a relational expression between the value of the variable and the formula including n when the loop statement is executed n times by obtaining a general term of a recurrence formula that expresses the generalized loop path information. An in-loop path generalization unit that generates in-loop path information;
A generalization rule generation unit that generates generalization rule information that is a rule expressed in a general term based on the path information in the generalization loop and the path information outside the loop;
A software specification analyzer further comprising:
請求項4に記載のソフトウェア仕様分析装置であって、
前記ループ文の実行回数の指定を受け付け、受け付けた前記実行回数を前記一般項化ルール情報に代入することにより、前記一般項で表現されたルールを具体化した情報を出力する出力処理部を備える、
ソフトウェア仕様分析装置。
The software specification analyzer according to claim 4,
An output processing unit is provided that receives designation of the number of executions of the loop statement, and outputs information embodying the rule expressed by the general term by substituting the accepted number of executions into the generalized rule information. ,
Software specification analyzer.
情報処理装置が、
分析対象のソフトウェアを実現するプログラムのソースコードを記憶するステップ、
前記ソースコードに含まれているループ文の記述を特定するステップ、
特定した前記ループ文以外の前記ソースコードの記述について記号実行を行うことにより、前記ソースコードのパス条件及びパス実行結果を含む情報であるループ外パス情報を、前記ループ文の実行前における変数の値と前記ループ文の実行後における変数の値とを用いて生成するステップ、
特定した前記ループ文について記号実行を行うことにより、前記ソースコードに含まれている各変数について、前記ループ文をn−1回実行した後における当該変数の値と、前記ループ文をn回実行した後における当該変数の値との関係を示す情報である汎化ループ内パス情報を生成するステップ、
ループを特定回数実行した場合における前記ソースコードのパスに関する情報である特化ループ内パス情報を生成するステップ、
生成した前記特化ループ内パス情報のうち、任意回数だけループを実行した場合における変数の値を含む第1の特化ループ内パス情報を取得し、前記第1の特化ループ内パス情報に前記汎化ループ内パス情報を適用することにより、前記第1の特化ループ内パス情報よりもループ回数が1つ大きい第2の特化ループ内パス情報を生成し、前記第2の特化ループ内パス情報と前記ループ外パス情報とに基づき、前記ソフトウェアの仕様を表すルールを含む情報であるルール情報を生成するステップ、
を実行する、ソフトウェア仕様分析方法。
Information processing device
Storing a source code of a program realizing the software to be analyzed;
Identifying a description of a loop statement included in the source code;
By performing symbol execution on the description of the source code other than the identified loop statement, path information outside the loop, which is information including the path condition of the source code and the path execution result, is stored in the variable before the execution of the loop statement. Generating using the value and the value of the variable after execution of the loop statement;
By executing symbol execution for the identified loop statement, for each variable included in the source code, the value of the variable after executing the loop statement n-1 times and the loop statement n times Generating generalized loop path information that is information indicating the relationship with the value of the variable after
Generating path information in a specialized loop that is information on the path of the source code when the loop is executed a specific number of times;
Among the generated special loop path information, first special loop path information including a variable value when a loop is executed an arbitrary number of times is acquired, and the first special loop path information is obtained as the first special loop path information. By applying the generalized loop path information, second specialized loop path information having a loop count one greater than the first specialized loop path information is generated, and the second specialized loop information is generated. Generating rule information, which is information including rules representing the software specifications, based on the in-loop path information and the out-of-loop path information;
Execute the software specification analysis method.
請求項6に記載のソフトウェア仕様分析方法であって、
前記情報処理装置が、
生成した前記特化ループ内パス情報を記憶するステップ、
ループの上限回数の指定を受け付け、記憶している前記特化ループ内パス情報のうちループ回数が最大のものを取得し、取得した前記特化ループ内パス情報に前記汎化ループ内パス情報を再帰的に適用することにより前記ループ上限回数までの前記特化ループ内パス情報を生成し、生成した前記特化ループ内パス情報と前記ループ外パス情報とを用いて前記ルールを生成するステップ、
をさらに実行する、ソフトウェア仕様分析方法。
A software specification analysis method according to claim 6,
The information processing apparatus is
Storing the generated path information in the specialized loop;
The specification of the upper limit number of loops is accepted, the stored path information in the specialized loop is acquired with the maximum number of loops, and the path information in the generalized loop is added to the acquired path information in the specialized loop. Generating the special loop path information up to the upper limit number of loops by applying recursively, and generating the rule using the generated special loop path information and the non-loop path information;
The software specification analysis method is further executed.
請求項6に記載のソフトウェア仕様分析方法であって、
前記情報処理装置が、前記ソースコードに含まれているループ文ごとにループの上限回数の指定を受け付け、前記ループ文ごとに、記憶している前記特化ループ内パス情報のうちループ回数が最大のものを取得し、前記ループ文ごとに、取得した前記特化ループ内パス情報に前記汎化ループ内パス情報を再帰的に適用することにより前記ループの上限回数までの前記特化ループ内パス情報を生成するステップ、
をさらに実行する、ソフトウェア仕様分析方法。
A software specification analysis method according to claim 6,
The information processing apparatus accepts designation of the upper limit number of loops for each loop statement included in the source code, and the maximum number of loops is stored in the stored special loop path information for each loop statement. For each loop statement, and recursively applying the path information in the generalized loop to the acquired path information in the specialized loop, and the path in the specialized loop up to the upper limit number of times of the loop Generating information,
The software specification analysis method is further executed.
請求項6に記載のソフトウェア仕様分析方法であって、
前記情報処理装置が、
前記汎化ループ内パス情報を表現した漸化式の一般項を求めることにより、前記ループ文をn回実行した場合における前記変数の値と、前記nを含む式との関係式である一般項化ループ内パス情報を生成するステップ、
前記一般項化ループ内パス情報と前記ループ外パス情報とに基づき、一般項で表現され
たルールである一般項化ルール情報を生成するステップ、
をさらに実行する、ソフトウェア仕様分析方法。
A software specification analysis method according to claim 6,
The information processing apparatus is
A general term that is a relational expression between the value of the variable and the formula including n when the loop statement is executed n times by obtaining a general term of a recurrence formula that expresses the generalized loop path information. Generating path information in the initialization loop,
Generating generalized rule information that is a rule expressed in a general term based on the path information in the generalized loop and the path information outside the loop;
The software specification analysis method is further executed.
請求項9に記載のソフトウェア仕様分析方法であって、
前記情報処理装置が、前記ループ文の実行回数の指定を受け付け、受け付けた前記実行回数を前記一般項化ルール情報に代入することにより、前記一般項で表現されたルールを具体化した情報を出力するステップ、
をさらに実行する、ソフトウェア仕様分析方法。



A software specification analysis method according to claim 9,
The information processing apparatus accepts designation of the number of executions of the loop statement, and outputs information embodying the rule expressed in the general term by substituting the accepted number of executions into the generalized rule information Step to do,
The software specification analysis method is further executed.



JP2017092887A 2017-05-09 2017-05-09 Software specification analyzer and software specification analysis method Active JP6802109B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017092887A JP6802109B2 (en) 2017-05-09 2017-05-09 Software specification analyzer and software specification analysis method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017092887A JP6802109B2 (en) 2017-05-09 2017-05-09 Software specification analyzer and software specification analysis method

Publications (2)

Publication Number Publication Date
JP2018190219A true JP2018190219A (en) 2018-11-29
JP6802109B2 JP6802109B2 (en) 2020-12-16

Family

ID=64479844

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017092887A Active JP6802109B2 (en) 2017-05-09 2017-05-09 Software specification analyzer and software specification analysis method

Country Status (1)

Country Link
JP (1) JP6802109B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023058609A1 (en) * 2021-10-08 2023-04-13 株式会社日立製作所 Defect analysis device and defect analysis method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023058609A1 (en) * 2021-10-08 2023-04-13 株式会社日立製作所 Defect analysis device and defect analysis method
JP2023056953A (en) * 2021-10-08 2023-04-20 株式会社日立製作所 Defect analysis device and defect analysis method
JP7631164B2 (en) 2021-10-08 2025-02-18 株式会社日立製作所 Fault analysis device and fault analysis method

Also Published As

Publication number Publication date
JP6802109B2 (en) 2020-12-16

Similar Documents

Publication Publication Date Title
US11841908B1 (en) Extraction rule determination based on user-selected text
US12360991B1 (en) Cell-based table manipulation of event data to generate search commands
US11663033B2 (en) Design-time information based on run-time artifacts in a distributed computing cluster
US11068452B2 (en) Column-based table manipulation of event data to add commands to a search query
US10949419B2 (en) Generation of search commands via text-based selections
US10896175B2 (en) Extending data processing pipelines using dependent queries
US10846316B2 (en) Distinct field name assignment in automatic field extraction
US11354308B2 (en) Visually distinct display format for data portions from events
KR101517460B1 (en) Graphic representations of data relationships
JP6449173B2 (en) Building an application to configure a process
CN110914818A (en) Data Flow Graph Configuration
Silva et al. Raw data queries during data-intensive parallel workflow execution
US8775392B1 (en) Revision control and configuration management
CN110209902B (en) Method and system for visualizing feature generation process in machine learning process
JP6692281B2 (en) Test case generation device and test case generation method
US20140136155A1 (en) Analyzing hardware designs based on component re-use
JP6996936B2 (en) Source code analyzer, source code analysis method, source code analysis program
JP7579451B2 (en) Software component update system and software component update method
JP6802109B2 (en) Software specification analyzer and software specification analysis method
JP6122742B2 (en) Specification change support apparatus, information processing method, and program
JP6668271B2 (en) Business specification analysis support apparatus, business specification analysis support method, and program
JP2013012082A (en) Test data generation program, test data generation method, and test data generation device
US20230143297A1 (en) Production knowledge management system, production knowledge management method, and production knowledge management program
US8775873B2 (en) Data processing apparatus that performs test validation and computer-readable storage medium
JP2011198034A (en) Data generation method, data generation device, and data generation program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20191216

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20201021

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: 20201117

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20201126

R150 Certificate of patent or registration of utility model

Ref document number: 6802109

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150