[go: up one dir, main page]

WO2016038741A1 - Source code equivalence verifying device, and source code equivalence verifying method - Google Patents

Source code equivalence verifying device, and source code equivalence verifying method Download PDF

Info

Publication number
WO2016038741A1
WO2016038741A1 PCT/JP2014/074282 JP2014074282W WO2016038741A1 WO 2016038741 A1 WO2016038741 A1 WO 2016038741A1 JP 2014074282 W JP2014074282 W JP 2014074282W WO 2016038741 A1 WO2016038741 A1 WO 2016038741A1
Authority
WO
WIPO (PCT)
Prior art keywords
source code
verification
equivalence
change
equivalence verification
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.)
Ceased
Application number
PCT/JP2014/074282
Other languages
French (fr)
Japanese (ja)
Inventor
鈴木 康文
敦介 新原
誠 市井
秀人 野口
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 PCT/JP2014/074282 priority Critical patent/WO2016038741A1/en
Priority to JP2016547643A priority patent/JP6279750B2/en
Publication of WO2016038741A1 publication Critical patent/WO2016038741A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software

Definitions

  • the present invention relates to an apparatus and a verification method for verifying that execution contents between source codes before and after the change are equivalent when the source code is changed.
  • Patent Document 1 There is a technique described in Patent Document 1 as a method for verifying equivalence of source codes.
  • Japanese Patent Application Laid-Open No. 2004-228561 discloses a method of performing a test on a portion where a difference is caused by source code comparison and comparing the result.
  • Non-Patent Document 1 discloses a technique for verifying that execution contents are maintained using symbol execution.
  • Refactoring and language replacement are methods for improving software maintainability.
  • Refactoring is a general term for methods for improving the design quality of software by changing the internal structure without changing the execution contents of the software.
  • Language replacement is the replacement of software developed using a programming language with low maintainability by recreating the same function as that software using another programming language with high maintainability.
  • This refactoring and language replacement technique is a promising technique for ensuring the maintainability of software that is becoming increasingly complex and large-scale.
  • the execution content of the target source code is changed when the source code of the software is changed or recreated, there is a possibility that a new defect may be mixed. Therefore, there is a possibility that the software developer fears that a defect is mixed in software that has been operating correctly due to refactoring or language replacement, and may decide not to do so.
  • a method for verifying that there is no change in the execution contents of the source code before and after the change of the source code is required.
  • both sources indicate that the external execution contents of the two source codes before and after the change are the same, that is, the same output is obtained at the time of execution for any same input.
  • the code to be “equivalent”. Further, verifying whether the source code before the change and the source code after the change are equivalent is referred to as “equivalence verification”.
  • Conditions required for the method for verifying that the source code before the change and the source code after the change are equivalent include the following conditions.
  • One condition is that most of the work is automated, and there are few manual work. Traditionally, source code equivalence has been verified by manual review and testing. By realizing automatic verification using a tool, verification man-hours are reduced, and refactoring and the like are promoted.
  • Another condition is to provide the developer with information on the basis and information on a portion to be corrected when it is determined that they are not equivalent by the equivalence checking method. By providing the developer with easy-to-understand information on points to be corrected, the developer can easily make corrections, leading to a reduction in the development period and man-hours.
  • Still another condition is that the verification time by the tool is short or can be shortened by parallelization. Even if the verification work is automated, if a long-time calculation is required for the verification, it is difficult to repeat the cycle of correcting and verifying again after verification. Therefore, it is necessary to use a verification method with a small amount of calculation or a verification method that can reduce the calculation time by parallelization even if the amount of calculation is large.
  • Patent Document 1 requires a test and cannot satisfy the condition (1).
  • the method according to Non-Patent Document 1 cannot obtain information on a portion to be corrected to be equivalent in a non-equivalent case, and cannot satisfy the condition (2).
  • a logical expression for verifying equivalence is generated and verified using a solver. However, this verification expression cannot be executed in parallel and satisfies the condition (3). I can't.
  • the source code equivalence verification device using symbol execution when the verification result is not equivalent, it is equivalent to the technology that provides information on the correction part on the source code necessary for the developer to make it equivalent. And a technology for executing the verification of the property in parallel.
  • the disclosed source code equivalence verification apparatus includes a symbol execution calculation unit that performs symbol execution calculation on a source code before change and a source code after change that has changed the source code before change. Based on the symbol execution summary, the equivalence that generates the equivalence verification formula for verifying the equivalence that the same output is obtained for the same input of the source code before the change and the source code after the change Verification result generator that generates verification result report using verification result in verification formula generator, equivalence verification formula verification unit that verifies equivalence verification formula generated by equivalence verification formula generation unit, and equivalence verification formula verification unit Part.
  • verification time is shortened by parallelizing individual verifications in order to verify equivalence for each control flow path on the source code for verifying equivalence. can do.
  • Symbol execution refers to execution using symbols instead of executing source code while substituting specific values for variables (input variables, global variables, etc.) used in source code when verifying source code
  • a combination of a variable state (hereinafter also referred to as a variable state) in a source code execution process and a conditional expression (hereinafter also referred to as a path constraint) for passing through the control path in the source code (hereinafter referred to as a snap).
  • This is a technique for obtaining the input / output relationship of the software indicated by the source code using the “Shot”.
  • the information processing apparatus In the symbol execution, the information processing apparatus generates the structure graph N100 shown in FIG. 2 by performing lexical analysis and syntax analysis similar to the compilation on the source code C100.
  • the structure graph N100 is obtained by removing the information that is not related to the meaning of the language and extracting only the information that is related to the meaning (abstracted) from the syntax tree.
  • a control flow is shown.
  • a solid line arrow indicates an unconditional control flow, and a broken line arrow indicates a conditional control flow.
  • each control flow starting from the node N1 corresponding to the function entry point and ending at the node N5 corresponding to the return statement that is the exit of the function is illustrated.
  • the information processing apparatus In generating the structure graph N100, the information processing apparatus gives position information on the source code C100 corresponding to each node. In the example illustrated in FIG. 2, the information processing apparatus assigns the line number in the source code C100 as position information. For example, in response to the if statement on the fourth line of the source code C100, the information processing apparatus stores L4 Position information is given.
  • the information processing apparatus generates an execution tree S100 shown in FIG. 3 based on the structure graph N100.
  • Each node of the execution tree S100 is represented by a combination of the path constraint (upper column) and the variable state (middle column) described above, and further, position information (lower column) indicating the position via the source code is represented. ing.
  • a root node (root node) S101 of the execution tree S100 corresponds to an initial state of execution of the source code.
  • the information processing apparatus adds new nodes to the execution tree S100 each time a variable is updated as the source code is executed.
  • the information processing apparatus When generating the execution tree S100, the information processing apparatus assigns a symbol variable corresponding to the value of the variable that becomes the input variable of the function foo.
  • the value of a variable serving as an input variable is a value of a variable that is given from outside the function and affects the operation of the function, and includes a function variable and a global variable that is accessed within the function.
  • a function argument a and a global variable g are input variables.
  • the information processing apparatus assigns “ ⁇ ” and “ ⁇ ” to the variables a and g as symbolic variables.
  • the information processing apparatus generates a root node S101 in the execution tree S100 based on the node N1 of the structure graph N100.
  • the information processing apparatus sets “no condition” indicating “no constraint” in the path constraint (upper column) S101a of the root node S101, and inputs variable a and g in the variable state (middle column) S101b.
  • the position information L2 acquired from the node N1 is set in the position information (lower column) S101c.
  • the information processing apparatus executes processing based on the next node N2 on the control flow of the node N1 of the structure graph N100.
  • the node N2 is a conditional branch node having two conditional control flows N21 and N22.
  • the information processing apparatus includes a child node S102 corresponding to the conditional control flow N21 and a child node S105 corresponding to the conditional control flow N22. Are generated as child nodes of the node S101.
  • variable state (middle column) of the node S102 is set to be the same as the variable state S101b of the parent node S101 because the variable state is not changed by the if statement.
  • position information (lower column) is “L2, 4” by adding the position information (L4) of the node N2 to the position information S101c of the parent node S101, and the second and fourth lines of the source code. Means you have been through.
  • variable state (middle column) in the node S105 is set to be the same as the variable state S101b of the parent node S101 because the variable state is not changed by the if statement. Further, the position information (lower column) is “L2, 4” by adding the position information (L4) of the node N2 to the position information S101c of the parent node S101.
  • the information processing apparatus executes processing based on N3 which is the next node on the control flow N21 of the node N2.
  • the information processing apparatus generates a child node S103 of S102 as a node in the execution tree S100 corresponding to the node N3.
  • the information processing apparatus executes processing based on N5 which is the next node on the control flow of the node N3.
  • the information processing apparatus executes processing based on N4 which is the next node on the control flow N22 of N2.
  • the node N4 is a conditional branch node having two conditional control flows N41 and N42, and the information processing apparatus displays a child node S106 corresponding to the conditional control flow N41 and a child node S110 corresponding to the conditional control flow N42. , Respectively, under the node S105.
  • the information processing apparatus repeats the above processing until the generation of all branches is completed for each branch.
  • the information processing apparatus finally obtains an execution tree S100 as shown in FIG. 3 from the structure graph N100 shown in FIG. 2 by the above processing.
  • symbol execution child nodes corresponding to conditional branches are generated in the execution tree so that all possible control flows are covered.
  • a leaf node in an execution tree is to obtain a set of a set of a condition (path constraint) for an input value of a source code and a state (variable state) of an output variable.
  • the leaf node of the execution tree at the time when the symbol execution is completed is referred to as “snapshot”, and the collection of snapshots is referred to as “symbol execution summary”.
  • symbol execution summary the collection of snapshots.
  • the leaf nodes in the execution tree S100 are the three nodes S104, S109, and S113, which are snapshots, and these sets are the symbol execution summary S120. However, the variable states of variables r and a which are local variables are excluded.
  • the symbol execution is described using the source code written in the C language.
  • the present invention is not limited to the C language, and can be similarly applied to the source code written using another programming language. .
  • FIG. 4 shows the hardware configuration of the source code equivalence verification apparatus of this embodiment.
  • the source code equivalence verification apparatus of the present embodiment is realized by a general computer as shown in FIG. 4, for example.
  • the source code equivalence verification apparatus 1000 includes a CPU (Central Processing Unit) 101, a main storage device 102, a network I / F 103, a graphic I / F 104, an input / output I / F 105, and an auxiliary storage device I / F 106 connected by a bus. It has become a form.
  • CPU Central Processing Unit
  • the CPU 101 controls each part of the source code equivalence verification apparatus 1000, loads the source code equivalence verification program 200 to the main storage device 102, and executes it.
  • the main storage device 102 is usually composed of a volatile memory such as a RAM, and a program executed by the CPU 101 and data to be referenced are loaded from an auxiliary storage device or the like and stored.
  • the network I / F 103 is an interface for connecting to the external network 150.
  • the graphic I / F 104 is an interface for connecting a display device 120 such as an LCD (Liquid Crystal Display).
  • a display device 120 such as an LCD (Liquid Crystal Display).
  • the input / output I / F 105 is an interface for connecting an input / output device.
  • a keyboard 131 and a mouse 132 as a pointing device are connected.
  • the auxiliary storage device I / F 106 is an interface for connecting an auxiliary storage device such as an HDD (Hard Disk Drive) 141 or a DVD (Digital Versatile Disk) drive device 142.
  • an auxiliary storage device such as an HDD (Hard Disk Drive) 141 or a DVD (Digital Versatile Disk) drive device 142.
  • the HDD 141 has a large storage capacity, and stores a source code equivalence verification program 200 for executing the processing of this embodiment.
  • the DVD drive device 142 is a device that writes data to or reads data from an optical disk such as a DVD or a CD.
  • the source code equivalence verification program 200 is provided by, for example, a CD-ROM. Can be installed.
  • the test data generation apparatus 1000 of the present embodiment installs the source code equivalence verification program 200 in the computer as described above and executes each function.
  • FIG. 5 shows a software configuration of the source code equivalence verification apparatus of the present embodiment.
  • a source code equivalence verification program 200 executed by the source code equivalence verification apparatus 1000 includes a source code reading module 201, a structure graph generation module 202, a symbol execution calculation module 203, an equivalence verification expression generation module 204, and an equivalence verification expression verification.
  • a module 205 and a verification result display module 206 are included.
  • the program equivalence verification program 200 is application software that runs on an OS (Operating System).
  • the software configuration of the source code equivalence verification device includes an OS and a library program, but is omitted in FIG. .
  • the source code reading module 201 is a module that reads the pre-change source code and the post-change source code to be verified from the HDD or another computer and stores them in the storage unit.
  • the structure graph generation module 202 is a module that generates a structure graph (for example, N100 described above) by performing lexical analysis / syntactic analysis of a source code (for example, C100 described above) and extracting a control flow.
  • the symbol execution calculation module 203 performs symbol execution based on the structure graph generated by the structure graph generation module 202 to calculate an execution tree (for example, S100 described above), and collects the leaf nodes of the symbol execution summary (for example, for example, This module generates S120) described above.
  • the equivalence verification expression generation module 204 is a verification logical expression for determining equivalence between the symbol execution summary of the source code before change and the symbol execution summary of the source code after change generated by the symbol execution calculation module 203. This module generates a certain equivalence verification formula.
  • the equivalence verification formula verification module 205 is a module that solves the equivalence verification formula generated by the equivalence verification formula generation module 204 as a satisfiability problem in graph theory using a SAT (SAT fidelity) solver or an SMT (Satisfiability Modulo Theories) solver. It is.
  • SAT SAT fidelity
  • SMT Stisfiability Modulo Theories
  • the verification result generation module 206 is a module that generates a verification result report using the verification result, symbol execution summary, and source code information output from the equivalence verification expression verification module 205, and displays or notifies the verification result report.
  • FIG. 6 shows a functional configuration diagram of the source code equivalence verification apparatus 1000.
  • the control unit 110 is realized by the CPU 101 and the main storage device 102 in FIG. 4, and the storage unit 140 is mainly realized by the HDD 141 in FIG. 4, but may include the main storage device 102.
  • the input device 130 includes the input / output I / F 105, the keyboard 131, the mouse 132, and the like of FIG. 4, and may further include a configuration for reading from the DVD drive device 142 via the auxiliary storage device I / F 106.
  • the output device 121 includes a graphic I / F 104, a display device 120, and the like, and may further include a configuration for writing to the DVD drive device 142 via the auxiliary storage device I / F 106.
  • the communication unit 103 represents the network I / F 103 in FIG. 4 and is connected to, for example, an external computer 160 via the network 150. Details of the control unit 110 and the storage unit 140 of FIG. 6 will be described with reference to
  • FIG. 7 shows a configuration and a data flow in the control unit 110 and the storage unit 140 of the source code equivalence verification apparatus 1000.
  • the source code input unit 111 reads the pre-change source code 301 and the post-change source code 302 to be verified, and stores them in the pre-change / post-change source code storage area 201.
  • the pre-change source code 301 and the post-change source code 302 are described using an example described in C language. However, the structure graph generation unit 112 and the symbol execution calculation unit corresponding to other languages are also described. By using 113, it is also possible to use source code written in another programming language. Different programming languages may be used for the source code 301 before change and the source code 302 after change.
  • the structure graph generation unit 112 executes source code analysis of each of the pre-change source code and the post-change source code stored in the pre-change / post-source code storage area 201, and the pre-change structure graph which is the analysis result
  • the post-change structure graph is stored in the pre-change / post-structure graph storage area 202.
  • the symbol execution calculation unit 113 performs symbol execution on each of the pre-change / post-structure graphs stored in the pre-change / post-structure graph storage area 202 for the post-change structure graph, and a symbol that is a calculation result (execution result)
  • the execution summary is stored in the before / after symbol execution result storage area 203.
  • the equivalence verification expression generation unit 114 uses a logic for verifying equivalence of both before and after the change from the before / after change execution summary stored in the before / after change execution result storage area 203.
  • An equivalence verification expression that is an expression is generated and stored in the equivalence verification expression storage area 204.
  • the equivalence verification formula verification unit 115 executes verification of the equivalence verification formula stored in the equivalence verification formula storage area 204 and stores the verification result of the verification formula in the equivalence verification formula result storage area 205.
  • the verification result generation unit 116 generates a verification result report 310 using information on the verification result of the equivalence verification formula, the symbol execution summary, and the source code, stores the verification result report 310 in the verification result storage area 206, and uses the output device 121. Displayed on the screen or transmitted to the external computer 160 using the communication unit 103.
  • each unit included in the control unit 110 is realized by the source code equivalence verification apparatus 1000 executing each module of the source code equivalence verification program shown in FIG. .
  • FIG. 8 is a process flowchart of source code equivalence verification. An example will be described in which the pre-change source code C100 shown in FIG. 1 is input as the pre-change source code, and the post-change source code C200 shown in FIG.
  • the source code input unit 111 reads the pre-change source code 301 to be verified and stores it in the pre-change / post-source code storage area 201. (P110).
  • the structure graph generation unit 112 performs source code analysis of the pre-change source code stored in the pre-change / post-change source code storage area 201, generates a pre-change structure graph as a result of the analysis, and before / after the change
  • the data is stored in the structure graph storage area 202 (P120).
  • the symbol execution calculation unit 113 executes symbol execution with respect to the pre-change structure graph stored in the pre-change / post-structure graph storage area 202, generates the execution result as the change issue execution summary, and displays the pre-change / post-change symbols.
  • the result is stored in the execution result storage area 203 (P130).
  • the process of the source code input unit 111 (P111), the process of the structure graph generation unit 112 (P121), and the process of the symbol execution calculation unit 113 (P131) are executed for the changed source code, and
  • the symbol execution summary is stored in the before / after symbol execution result storage area 203.
  • processing steps P110, P120, and P130 for the source code before the change and the processing steps P111, P121, and P131 for the source code after the change can be executed independently, they may be processed in parallel.
  • the structure graph generation and re-use can be performed by reusing the previous processing result stored in the pre-change / post-symbol execution result storage area 203. Symbolic execution calculations can be omitted.
  • the equivalence verification formula generator 114 generates an equivalence verification formula using the symbol execution summary of the source code before the change and the symbol execution summary of the source code after the change (P140).
  • FIG. 9 shows a post-change source code C200 that is changed from the pre-change source code C100.
  • FIG. 10 shows a symbol execution summary S220 generated from the changed source code C200. Using the symbol execution summary S120 shown in FIG. 3 generated from the source code C100 before change shown in FIG. 1 and the symbol execution summary S220 shown in FIG. 10 generated from the source code C200 after change shown in FIG. The generation of the expression will be specifically described.
  • a snapshot constraint expression is generated by taking the conjunction of the path constraint and the equal sign condition of each variable state.
  • the output variables g and R in the changed symbol execution summary constraint expression are replaced with g ′ and R ′, respectively, in order to avoid a conflict with the variable name in the change execution summary constraint expression. Yes.
  • the equivalence verification formula verification unit 115 determines satisfiability of the equivalence verification formula generated by the equivalence verification formula generation unit 114 using a SAT solver, an SMT solver, or the like (P150).
  • the equivalence verification formula verification unit 115 verifies whether the equivalence verification formula is satisfiable or not, and a counter example that is an example of a satisfiable variable value that is output if the equivalence verification formula is satisfiable. As a result, it is stored in the equivalence verification formula verification result storage area 205. In this example, since it is determined that the equivalence checking expression is unsatisfiable, it is stored as unsatisfiable.
  • the verification result generation unit 116 generates, for example, a verification result report 500 as shown in FIG. 11 based on the verification result by the equivalence verification formula verification unit 115 (P160).
  • the verification result report 500 as the verification result display 510, “equivalent” is displayed when the equivalence verification expression verification result cannot be satisfied, and “non-equivalent” when it can be satisfied.
  • the verification result 510 is displayed as “equivalent”.
  • the verification result report 500 may include a display of the source code 521 before the change and the source code 522 after the change using the source code stored in the before / after source code storage area 201. Further, the verification result report 500 may include a display of the changed symbol execution summary 531 and the changed symbol execution summary 532 using the symbol execution summary information stored in the before / after symbol execution result storage area 203. . In the symbol execution summary displays 531 and 532 in FIG. 11, the path constraints and variable states are displayed in one line for each snapshot.
  • Each process of the control unit 110 is as described above, and an execution tree S300 and a symbol execution summary S320 as shown in FIG. 13 are generated from the changed source code C300 by the process (P131) of the symbol execution calculation unit 113. .
  • the verification result generation unit 116 generates a verification result report 550 as shown in FIG.
  • the verification result report 550 since the equivalence verification formula verification result can be satisfied, “not equivalent” is displayed as the verification result display 560. Moreover, the display of the source code 571 before the change and the source code 572 after the change and the display of the changed code execution summary 581 and the changed symbol execution summary 582 may be included.
  • the verification result report 550 may include a display of counterexample information 590 that is not equivalent using counterexample information stored in the equivalence verification formula verification result storage area 205.
  • the counterexample is classified into an input variable, an output variable of the source code before change, and an output variable of the source code after change, and a value obtained as a counterexample is displayed.
  • Variables having different values between the output variable before change and the output variable after change may be highlighted by underlining. By this display, the developer can know the value of the input variable that is specifically unequal, and the value of the output variable before and after the change at that time.
  • the equivalence (referred to as path equivalence) between when a specific path of the source code before the change and the specific path of the source code after the change is taken is a combination of all paths.
  • Equivalence verification is realized by verifying against.
  • the processes of the source code input unit 111, the structure graph generation unit 112, and the symbol execution calculation unit 113 are the same as those in the first embodiment, and a description thereof is omitted.
  • FIG. 15 is a processing flowchart of the equivalence verification expression generation unit 114 in this embodiment.
  • the equivalence verification formula generation unit 114 acquires the symbol execution summary of the source code before the change from the pre-change / post-symbol execution result storage area 203 (P141). If there is no unprocessed snapshot before change (P142), the equivalence verification expression generation unit 114 ends the process.
  • the equivalence verification expression generation unit 114 selects one snapshot from the pre-change execution summary (P143), and acquires the post-change symbol execution summary from the pre-change / post-code execution result storage area 203 (P144). If there is no unprocessed snapshot after change (P145), the equivalence verification expression generation unit 114 returns to P142.
  • the equivalence verification formula generation unit 114 selects one snapshot of the post-change symbol execution summary (P146), generates a path equivalence verification formula (step P147), and returns to P145.
  • the equivalence verification formula generation unit 114 If there is no unprocessed pre-change snapshot (P145), the equivalence verification formula generation unit 114 returns to P142, and therefore generates a path equivalence verification formula for all combinations of the pre-change snapshot and the post-change snapshot. it can.
  • the equivalence verification expression generation unit 114 generates a path equivalence verification expression for verifying equivalence in the range that has passed through the path corresponding to the snapshot, for the selected pre-change snapshot and post-change snapshot. It is generated and stored in the equivalence verification formula storage area 204 (P147).
  • the path equivalence verification expression consists of the negation expression of the conjunction of the equality constraint expression between the corresponding output variables, the snapshot constraint expression of the selected before-change snapshot, and the snapshot constraint expression of the selected after-change snapshot. It becomes the conjunction of
  • the equivalence verification expression generation unit 114 selects one snapshot at a time and generates a path equivalence verification expression.
  • the equivalence verification expression generation unit 114 may select a plurality of snapshots at a time. In that case, the selection of the snapshot constraint formula corresponding to the selected snapshot is used instead of the snapshot constraint formula used to generate the path equivalence verification formula.
  • the equivalence verification expression generation unit 114 that generates the path equivalence verification expression starts processing after the processing of the symbol execution calculation part 113 is completed.
  • the generation of a part of the snapshot is completed during execution of the above, even if the processing of the equivalence verification expression generation unit 114 is started to generate a path equivalence verification expression for the combination related to the snapshot good.
  • the equivalence verification formula verification unit 115 determines satisfiability using a SAT solver or the like for each of the plurality of path equivalence verification formulas generated by the equivalence verification formula generation unit 114.
  • the equivalence verification formula verification unit 115 is an example of the result of whether each path equivalence verification formula is satisfiable or not, and the value of a variable that the solver outputs if it can be satisfied.
  • a counterexample is recorded in the equivalence verification expression verification result storage area 205.
  • FIG. 16 shows a verification result 700 of each path equivalence verification formula in this example.
  • the nine combinations of the pre-change snapshot and the post-change snapshot six are unsatisfactory. Further, the remaining three patterns can be satisfied, and for example, a counter example as shown in the counter example column of FIG. 16 can be obtained.
  • the verification result generation unit 116 In the verification result generation step P160, the verification result generation unit 116 generates a verification result report 600 as shown in FIG.
  • the verification result display 610 shows “equivalent” when all path equivalence verification expression verification results are unsatisfiable and “non-existence” when there is a satisfiable path equivalence verification expression. “Equivalent” is displayed. In this example, for example, “not equivalent” is displayed because the path equivalence verification formula when the snapshot S113 and the snapshot S322 are selected can be satisfied.
  • the verification result report 600 may include the display of the change issue execution summary 631 and the post-change symbol execution summary 632 using the symbol execution summary information stored in the pre-change / post-change symbol execution result storage area 203. At this time, the snapshot verification result 639 can be displayed.
  • the verification result 639 of the snapshot refers to the verification result 700 of each path equivalence verification expression. If all the verification results of the path equivalence verification expression that selected the snapshot are unsatisfiable, “equivalent” can be satisfied. If there is a valid path equivalence verification expression, “not equivalent” is displayed.
  • the verification result report may include a display of counterexample information 640 that is non-equivalent using counterexample information stored in the equivalence verification formula verification result storage area 205.
  • a check box 638 for selecting a snapshot may be provided while the symbol execution summary is displayed, and a counter-example of the path equivalence verification formula for the selected combination of snapshots may be displayed.
  • the verification result report 600 may further include a display of the pre-change source code 621 and the post-change source code 622 using the source code stored in the pre-change / post-source code storage area 201.
  • the path of the snapshot may be displayed on the source code from the position information of the snapshot.
  • the path of the snapshot S113 is displayed as an underline on the source code 621 before the change using the position information of the snapshot S113. Further, the path of the snapshot S322 is displayed as an underline on the changed source code 622 using the position information of the snapshot S322.
  • the background is displayed in a different color, the font is highlighted by changing the font or character size, and the display other than the route is deleted. Then, there is a method such that only the route is displayed.
  • the path corresponding to the selected snapshot is displayed on the source code, and the counter example corresponding to the combination of them is displayed. It becomes possible to narrow down the range to be investigated, and it becomes easy to find the cause that is not equivalent.
  • FIG. 18 shows an example of display when a plurality of snapshots are selected in the check box 638 for selecting a snapshot in the verification result report 600.
  • a radio button 650 for selecting a display method for a plurality of snapshot paths can be provided, and the paths can be displayed according to the display method selected there.
  • “common” and “merger” are prepared. When “common” is selected, only a portion through which all the selected snapshots pass is displayed as a route. When “Merger” is selected, a portion through which at least one of the selected snapshots passes is displayed as a route.
  • snapshots S322 and S323 which are non-equivalent snapshots are selected, and “common” is selected as the display method. Therefore, only the part where both snapshots pass is displayed as a route.
  • the color density is changed according to the number of snapshots that pass through, or There are methods to change the character size.
  • the equivalence verification formula generation unit 114 compares the equivalence verification formula generated in the first embodiment (referred to as an overall equivalence verification formula in the description of this embodiment) with the path equivalence verification formula generated in the second embodiment. Then, the number of terms in each path equivalence verification formula is smaller than the number of terms in the overall equivalence verification formula, and the amount of calculation is also small, so the verification time in the solver is also shortened. On the other hand, the total calculation amount of all the path equivalence verification formulas is larger than the calculation amount of the overall equivalence verification formulas.
  • the source code equivalence verification apparatus 1000 executes a combination of verification based on the overall equivalence verification formula and verification based on the path equivalence verification formula.
  • the source code equivalence verification apparatus 1000 has a plurality of CPUs 101 or CPU cores and can execute a plurality of calculations simultaneously in parallel.
  • parallel calculation may be realized by using an external computer 160 in a cloud computing environment or a grid computing environment through the external network 150.
  • FIG. 15 is a process flowchart in process step P140 of the equivalence verification expression generation unit 114 in the present embodiment. The details are shown in FIG.
  • the equivalence verification formula generation unit 114 acquires the symbol execution summary of the source code before change from the pre-change / post-symbol execution result storage area 203 (P141).
  • the processes of the source code input unit 111, the structure graph generation unit 112, and the symbol execution calculation unit 113 are the same as those in the first embodiment, and a description thereof is omitted.
  • the equivalence verification formula generation unit 114 of the present embodiment executes both the equivalence verification formula generation unit 114 shown in the first embodiment and the equivalence verification formula generation unit 114 shown in the second embodiment. Then, both the overall equivalence verification formula and the path equivalence verification formula are stored in the equivalence verification formula storage area 204.
  • FIG. 19 is an example of a processing flowchart of the equivalence verification formula verification unit 115 in the present embodiment.
  • the equivalence verification formula verification unit 115 starts verification of the overall equivalence verification formula (P201).
  • the equivalence verification expression verification unit 115 determines whether or not there remains an expression that has not yet been verified among the path equivalence verification expressions (P202). Transition.
  • the equivalence verification formula verification unit 115 determines whether there is a free CPU core in order to newly start verification of the path equivalence verification formula (P203). To do.
  • the equivalence verification formula verification unit 115 selects one of the path equivalence verification formulas that have not yet been verified (P204). The equivalence verification formula verification unit 115 starts verification of the selected path equivalence verification formula on an available CPU core (P205), and proceeds to P206.
  • the equivalence verification formula verification unit 115 subsequently determines the end of verification of each equivalence verification formula that has started verification.
  • the equivalence verification formula verification unit 115 determines whether or not the verification of the overall equivalence verification formula has been completed (P206). If the verification is complete, the process proceeds to P207. If not, the process proceeds to P208.
  • the equivalence verification formula verification unit 115 determines whether the verification result of the overall equivalence verification formula is unsatisfactory (P207). If it cannot be satisfied, the equivalence verification result is “equivalent”, so there is no need to continue the verification of the path equivalence verification formula, and the equivalence verification formula verification unit 115 ends the processing.
  • the equivalence verification formula verification unit 115 proceeds to P208 and continues to verify the path equivalence verification formula.
  • the equivalence verification expression verification unit 115 determines whether there is a path equivalence verification expression that has been newly verified (P208). If there is, the process proceeds to P209, and if not, the process proceeds to P211.
  • the equivalence verification formula verification unit 115 determines whether the verification result of the path equivalence verification formula that has been newly verified is satisfiable (P209). If the verification result is satisfiable, the process proceeds to P210 and cannot be satisfied. If not, the process proceeds to P211.
  • the equivalence verification formula verification unit 115 generates a partial verification result report (P210). This process (P210) is executed when a new “non-equivalent” snapshot combination is discovered.
  • the partial verification result report is generated by the same method as the processing of the verification result generation unit 116 described in the second embodiment, using the completed path equivalence verification expression verification result.
  • step P211 the equivalence verification formula verifying unit 115 determines whether or not the verification of all the path equivalence verification formulas has been completed (P211).
  • the equivalence verification formula verification unit 115 proceeds to P202 and starts or ends verification of a new path equivalence verification formula. Repeat the waiting process.
  • a method for selecting one of the path equivalence verification formulas that have not yet started verification in P204 a method for selecting a verification formula with a small number of terms in the path equivalence verification formula, or a method used in the formula is used.
  • verification using the overall equivalence verification formula can be omitted.
  • P201, P206, and P207 can be omitted from the processing steps shown in FIG.
  • partial verification result generation can be omitted.
  • P208, P209, and P210 can be omitted from the processing steps shown in FIG.
  • the present invention is not limited to the first to third embodiments described above, and includes various modifications.
  • the above-described embodiments have been described in detail for easy understanding of the present invention, and are not necessarily limited to those having all the configurations described.
  • a part of the configuration of a certain embodiment can be replaced with another embodiment, and the configuration of another embodiment can be added to the configuration of a certain embodiment.
  • Each of the above-described configurations, functions, processing units, processing means, and the like may be realized by hardware by designing a part or all of them with, for example, an integrated circuit.
  • Source code equivalence verification apparatus 101 ... CPU, 102 ... Main storage device, 103 ... Network I / F, 105 ... Input / output I / F, 106 ... Auxiliary storage device I / F, 110 ... Control part, 120 ... Display / output device 130 ... Input device 140 ... Storage unit 150 ... External network 160 ... External computer 200 ... Source code equivalence verification program 201 ... Before / after source code storage area 202 ... Before change / Post structure graph storage area, 203 ... Pre-change / post symbol execution result storage area, 204 ... Equivalence verification expression storage area, 205 ...
  • Equivalence verification expression verification result storage area 206 ... Verification result storage area, 111 ... Source code input , 112... Structure graph generation unit, 113... Symbol execution calculation unit, 114... Equivalence verification expression generation unit, 115. ... verification result generation unit, 301 ... source code before change, 302 ... source code after change, 310 ... verification result report, S100, S200, S300 ... execution tree for symbol execution, S120, S220, S320 ... symbol execution summary, S104, S109, S113, S321 to S323 ... Snapshot in symbol execution, 500, 550, 600 ... Verification result report.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A source code equivalence verifying device comprises: a symbolic execution calculating unit which performs a symbolic execution calculation with respect to a source code before modification, and a source code after modification, being the source code before modification that has been modified; an equivalence verification formula generating unit which, on the basis of a symbolic execution summary, which is the result of the symbolic execution calculation performed by the symbolic execution calculating unit, generates an equivalence verification formula for verifying the equivalence, which indicates that the same output is obtained in response to the same input, between the source code before modification and the source code after modification; an equivalence verification formula verifying unit which verifies the equivalence verification formula generated by the equivalence verification formula generating unit; and a verification result generating unit which generates a verification result report using the result of the verification carried out by the equivalence verification formula verifying unit.

Description

ソースコード等価性検証装置、および、ソースコード等価性検証方法Source code equivalence verification apparatus and source code equivalence verification method

 本発明は、ソースコードを変更した際に変更前後のソースコード間の実行内容が等価であることを検証するための装置、および、検証方法に関する。 The present invention relates to an apparatus and a verification method for verifying that execution contents between source codes before and after the change are equivalent when the source code is changed.

 ソースコードの等価性を検証するための手法として、特許文献1に記載の技術がある。特許文献1では、ソースコード比較によって差異が生じている部分にテストを実施し、その結果を比較する手法が開示されている。 There is a technique described in Patent Document 1 as a method for verifying equivalence of source codes. Japanese Patent Application Laid-Open No. 2004-228561 discloses a method of performing a test on a portion where a difference is caused by source code comparison and comparing the result.

 また、非特許文献1では、記号実行を用いて実行内容が維持されていることを検証する手法が開示されている。 Further, Non-Patent Document 1 discloses a technique for verifying that execution contents are maintained using symbol execution.

米国特許出願公開第2007/0033576号公報US Patent Application Publication No. 2007/0033576

S. Person, M. B. Dwyer, S. Elbaum, C. S. Pasareanu, "Differential Symbolic Execution", Proc. of ACM SIGSOFT International Symposium on the Foundations of Software Engineering 2008, pp. 226-237, USA, 2008S. Person, M. B. Dwyer, S. Elbaum, C. S. Pasareanu, "Differential Symbolic Execution", Proc. Of ACM SIGSOFT International Symposium on the Foundations of Software Engineering 2008, pp. 226-237,

 近年、情報処理社会が進展することにより、ソフトウェアシステムが一般社会に浸透し、ソフトウェアに求められる信頼性が非常に高度なものになってきている。一方で、ソフトウェアは、長年にわたる差分・派生開発によって複雑化および大規模化の一途をたどり、ソフトウェアの拡張しやすさや理解しやすさといった保守性の低下が問題となっている。 In recent years, with the development of the information processing society, software systems have penetrated the general society, and the reliability required for software has become extremely high. On the other hand, software is becoming increasingly complex and large-scale due to many years of differential / derivative development, and there is a problem of deterioration in maintainability such as ease of software expansion and ease of understanding.

 ソフトウェアの保守性を向上させる方法としてリファクタリングや言語リプレースがある。リファクタリングは、ソフトウェアの実行内容を変えずに、内部構造を変更することにより、ソフトウェアの設計品質を改善する手法の総称である。言語リプレースは、保守性の低いプログラミング言語を用いて開発されたソフトウェアに対して、そのソフトウェアと同じ機能を保守性の高い他のプログラミング言語を用いて作り直すことにより置き換えることである。 ∙ Refactoring and language replacement are methods for improving software maintainability. Refactoring is a general term for methods for improving the design quality of software by changing the internal structure without changing the execution contents of the software. Language replacement is the replacement of software developed using a programming language with low maintainability by recreating the same function as that software using another programming language with high maintainability.

 このリファクタリングや言語リプレースの手法は、複雑化および大規模化の一途をたどるソフトウェアの保守性を確保するために有望な技術である。しかし、ソフトウェアのソースコードの変更や作り直しの際に、対象となっているソースコードの実行内容を変えてしまうと、新たに不具合を混入してしまう可能性がある。そのため、ソフトウェア開発者が、リファクタリングや言語リプレースが原因で正しく動作していたソフトウェアに不具合が混入することをおそれ、それらを行わない判断が有り得る。ソフトウェアの保守段階において、リファクタリングや言語リプレースを積極的に行うためには、ソースコードの変更前後で、両者のソースコードの実行内容の変化が無いことを検証する手法が求められる。 This refactoring and language replacement technique is a promising technique for ensuring the maintainability of software that is becoming increasingly complex and large-scale. However, if the execution content of the target source code is changed when the source code of the software is changed or recreated, there is a possibility that a new defect may be mixed. Therefore, there is a possibility that the software developer fears that a defect is mixed in software that has been operating correctly due to refactoring or language replacement, and may decide not to do so. In order to actively perform refactoring and language replacement in the software maintenance stage, a method for verifying that there is no change in the execution contents of the source code before and after the change of the source code is required.

 本明細書中において、変更前と変更後の二つのソースコードの外的な実行内容が同じであること、すなわち、任意の同じ入力に対して、実行時に同じ出力が得られることを、両ソースコードが「等価」であると定義する。また、変更前のソースコードと変更後のソースコードが、等価であるかどうかを検証することを「等価性検証」ということにする。 In the present specification, both sources indicate that the external execution contents of the two source codes before and after the change are the same, that is, the same output is obtained at the time of execution for any same input. Define the code to be “equivalent”. Further, verifying whether the source code before the change and the source code after the change are equivalent is referred to as “equivalence verification”.

 変更前のソースコードと変更後のソースコードが等価であることを検証する手法に求められる条件としては以下のような条件がある。
(1)一つの条件は、その作業の大部分が自動化されており、人手による作業が少ないことである。従来、ソースコードの等価性は、人手によるレビューやテストによって検証されていた。これをツールによる自動的な検証を実現にすることにより、検証工数が削減され、リファクタリング等が促進される。
(2)他の条件は、等価性検証手法により非等価であると判断された場合に、その根拠となる情報や修正すべき箇所に関する情報を開発者に提供することである。開発者に分かり易く修正すべき箇所の情報を提供することにおり、開発者による修正が容易となり、開発期間や工数の短縮につながる。
(3)さらに他の条件は、ツールによる検証時間が短い、もしくは、並列化により短縮すること可能であることである。検証作業が自動化されたとしても、その検証に長時間の計算が必要であれば、検証後に修正して再度検証するというサイクルを繰り返すことが困難となる。そのため、計算量が少ない検証手法を用いるか、計算量が多くても並列化により計算時間を短縮できる検証手法が必要となる。
Conditions required for the method for verifying that the source code before the change and the source code after the change are equivalent include the following conditions.
(1) One condition is that most of the work is automated, and there are few manual work. Traditionally, source code equivalence has been verified by manual review and testing. By realizing automatic verification using a tool, verification man-hours are reduced, and refactoring and the like are promoted.
(2) Another condition is to provide the developer with information on the basis and information on a portion to be corrected when it is determined that they are not equivalent by the equivalence checking method. By providing the developer with easy-to-understand information on points to be corrected, the developer can easily make corrections, leading to a reduction in the development period and man-hours.
(3) Still another condition is that the verification time by the tool is short or can be shortened by parallelization. Even if the verification work is automated, if a long-time calculation is required for the verification, it is difficult to repeat the cycle of correcting and verifying again after verification. Therefore, it is necessary to use a verification method with a small amount of calculation or a verification method that can reduce the calculation time by parallelization even if the amount of calculation is large.

 特許文献1による手法は、テストを必要としており、(1)の条件を満たすことができない。また、非特許文献1による手法は、非等価な場合に等価とするために必要な修正をすべき箇所の情報を得ることができず、(2)の条件を満たすことができない。さらに、非特許文献1では、等価性を検証するための論理式を生成し、ソルバを用いて検証しているが、この検証式を並列に実行することができず(3)の条件を満たすことができない。 The method according to Patent Document 1 requires a test and cannot satisfy the condition (1). In addition, the method according to Non-Patent Document 1 cannot obtain information on a portion to be corrected to be equivalent in a non-equivalent case, and cannot satisfy the condition (2). Furthermore, in Non-Patent Document 1, a logical expression for verifying equivalence is generated and verified using a solver. However, this verification expression cannot be executed in parallel and satisfies the condition (3). I can't.

 そこで、記号実行を用いたソースコード等価性検証装置において、検証結果が非等価である場合に、開発者が等価にするために必要なソースコード上の修正箇所に関する情報を提供する技術と、等価性検証を並列に実行する技術とが必要とされる。 Therefore, in the source code equivalence verification device using symbol execution, when the verification result is not equivalent, it is equivalent to the technology that provides information on the correction part on the source code necessary for the developer to make it equivalent. And a technology for executing the verification of the property in parallel.

 開示するソースコード等価性検証装置は、変更前ソースコードと変更前ソースコードを変更した変更後ソースコードとを対象に、それぞれ記号実行計算する記号実行計算部、記号実行計算部の記号実行計算結果である記号実行サマリに基づいて、変更前ソースコードと変更後ソースコードとの、同じ入力に対して同じ出力が得られることである等価性を検証するための等価性検証式を生成する等価性検証式生成部、等価性検証式生成部で生成された等価性検証式を検証する等価性検証式検証部、等価性検証式検証部における検証結果を用いて検証結果レポートを生成する検証結果生成部を有する。 The disclosed source code equivalence verification apparatus includes a symbol execution calculation unit that performs symbol execution calculation on a source code before change and a source code after change that has changed the source code before change. Based on the symbol execution summary, the equivalence that generates the equivalence verification formula for verifying the equivalence that the same output is obtained for the same input of the source code before the change and the source code after the change Verification result generator that generates verification result report using verification result in verification formula generator, equivalence verification formula verification unit that verifies equivalence verification formula generated by equivalence verification formula generation unit, and equivalence verification formula verification unit Part.

 開示するソースコード等価性検証装置によれば、等価性を検証するソースコード上の制御フローのパス毎に等価性を検証するため、個々の検証を並列化することにより、検証時間の短縮を実現することができる。 According to the disclosed source code equivalence verification device, verification time is shortened by parallelizing individual verifications in order to verify equivalence for each control flow path on the source code for verifying equivalence. can do.

 また、制御フローのパス毎の等価性検証結果を用いることにより、等価にするための修正を行う際に、ソースコード上で調査が必要な範囲を絞り込むことが可能となり、開発者による修正の時間と工数を削減することができる。 In addition, by using equivalence verification results for each path of the control flow, it is possible to narrow down the range that needs to be investigated on the source code when making corrections for equivalence, and the time for correction by the developer And man-hours can be reduced.

ソースコード等価性検証に用いる変更前ソースコードの例である。It is an example of the source code before a change used for source code equivalence verification. ソースコード解析の結果得られる構造グラフの例を示す図である。It is a figure which shows the example of the structure graph obtained as a result of a source code analysis. 記号実行を計算することにより得られる実行木を示す図である。It is a figure which shows the execution tree obtained by calculating symbol execution. ソースコード等価性検証装置のハードウェア構成図である。It is a hardware block diagram of a source code equivalence verification apparatus. ソースコード等価性検証装置のソフトウェア構成図である。It is a software block diagram of a source code equivalence verification apparatus. ソースコード等価性検証装置の機能構成図である。It is a functional block diagram of a source code equivalence verification apparatus. ソースコード等価性検証装置の制御部と記憶部のデータフローを示した図である。It is the figure which showed the data flow of the control part and memory | storage part of a source code equivalence verification apparatus. ソースコード等価性検証の処理フローチャートである。It is a processing flowchart of source code equivalence verification. ソースコード等価性検証に用いる、等価となるような変更を実施した変更後ソースコードの例である。It is an example of the source code after a change which implemented the change which becomes equivalent used for source code equivalence verification. 記号実行を計算することにより得られる実行木を示す図である。It is a figure which shows the execution tree obtained by calculating symbol execution. 等価性検証装置が出力する検証結果レポートの例を示す図である。It is a figure which shows the example of the verification result report which an equivalence verification apparatus outputs. ソースコード等価性検証に用いる、非等価となるような変更を実施した変更後ソースコードの例である。It is an example of the source code after a change which implemented the change which becomes non-equivalent used for source code equivalence verification. 記号実行を計算することにより得られる実行木を示す図である。It is a figure which shows the execution tree obtained by calculating symbol execution. 等価性検証装置が出力する検証結果レポートの例を示す図である。It is a figure which shows the example of the verification result report which an equivalence verification apparatus outputs. 等価性検証式生成部の処理フローチャートである。It is a process flowchart of an equivalence verification formula production | generation part. 等価性検証式検証部における各パス等価性検証式の検証結果の例である。It is an example of a verification result of each path equivalence verification formula in the equivalence verification formula verification unit. 等価性検証装置が出力する検証結果レポートの例を示す図である。It is a figure which shows the example of the verification result report which an equivalence verification apparatus outputs. 複数のスナップショットを選択した時の表示例を示す図である。It is a figure which shows the example of a display when a some snapshot is selected. ソースコード等価性検証装置における等価性検証式検証処理部の処理フローチャートである。It is a process flowchart of the equivalence verification type | formula verification process part in a source code equivalence verification apparatus.

 本実施形態の前提となる技術である記号実行について説明する。記号実行とは、ソースコードの検証に際し、ソースコード中に用いられている変数(入力変数、グローバル変数等)に具体的な値を代入しつつソースコードを実行する代わりに、記号を用いて実行し、ソースコードの実行過程における変数の状態(以下、変数状態とも称する。)とソースコード中の当該制御パスを経るための条件式(以下、パス制約とも称する。)との組み合わせ(以下、スナップショットとも称する。)を用いてソースコードが示すソフトウェアの入出力関係を求める技術である。 The symbol execution that is a premise technique of this embodiment will be described. Symbol execution refers to execution using symbols instead of executing source code while substituting specific values for variables (input variables, global variables, etc.) used in source code when verifying source code A combination of a variable state (hereinafter also referred to as a variable state) in a source code execution process and a conditional expression (hereinafter also referred to as a path constraint) for passing through the control path in the source code (hereinafter referred to as a snap). This is a technique for obtaining the input / output relationship of the software indicated by the source code using the “Shot”.

 記号実行によれば、ソースコードが取り得るすべてのパスを網羅してソースコードを検証することができる。以下、図1のC言語で記述されたソースコードC100について情報処理装置を用いて記号実行を行う場合を例として説明する。 記号 According to symbol execution, it is possible to verify the source code covering all possible paths of the source code. Hereinafter, a case where symbol execution is performed using the information processing apparatus for the source code C100 described in the C language in FIG. 1 will be described as an example.

 記号実行において、情報処理装置は、ソースコードC100を対象に、コンパイルと同様の字句分析や構文分析を行うことにより、図2に示す構造グラフN100を生成する。構造グラフN100は、ソースコードの抽象構文木(構文木から、言語の意味に関係ない情報を取り除き、意味に関係ある情報のみを取り出した(抽象した)木構造のデータ構造)の各ノード間の制御フローを示しており、実線矢印は条件の付かない制御フロー、破線矢印は条件付き制御フローを表している。 In the symbol execution, the information processing apparatus generates the structure graph N100 shown in FIG. 2 by performing lexical analysis and syntax analysis similar to the compilation on the source code C100. The structure graph N100 is obtained by removing the information that is not related to the meaning of the language and extracting only the information that is related to the meaning (abstracted) from the syntax tree. A control flow is shown. A solid line arrow indicates an unconditional control flow, and a broken line arrow indicates a conditional control flow.

 図2に示す関数fooの構造グラフN100では、関数のエントリーポイントに対応するノードN1から始まり、関数の出口であるreturn文に対応するノードN5に終わる各制御フローが図示されている。また、if文に対応するノードN2からは複数の条件付き制御フローがあり、if文の条件の成立/不成立に応じて異なる制御フローがあることを示している。 In the structure graph N100 of the function foo shown in FIG. 2, each control flow starting from the node N1 corresponding to the function entry point and ending at the node N5 corresponding to the return statement that is the exit of the function is illustrated. In addition, it is shown that there are a plurality of conditional control flows from the node N2 corresponding to the if statement, and there are different control flows depending on whether or not the condition of the if statement is satisfied.

 構造グラフN100の生成にあたって、情報処理装置は、各ノードに対応するソースコードC100上の位置情報を付与する。図2に示す例においては、情報処理装置は、ソースコードC100中の行番号を位置情報として付与しており、例えばソースコードC100の4行目のif文に対応して、ノードN2にはL4という位置情報を付与している。 In generating the structure graph N100, the information processing apparatus gives position information on the source code C100 corresponding to each node. In the example illustrated in FIG. 2, the information processing apparatus assigns the line number in the source code C100 as position information. For example, in response to the if statement on the fourth line of the source code C100, the information processing apparatus stores L4 Position information is given.

 情報処理装置は、構造グラフN100に基づき、図3に示す実行木S100を生成する。実行木S100の各ノードは、前述したパス制約(上欄)と変数状態(中欄)との組み合わせで表され、さらに、ソースコード上で経由した位置を表わす位置情報(下欄)が表されている。実行木S100の根ノード(ルートノード)S101は、ソースコードの実行の初期状態に対応する。情報処理装置は、ソースコードの実行に伴って変数が更新される度に実行木S100に新たなノードを追加していく。 The information processing apparatus generates an execution tree S100 shown in FIG. 3 based on the structure graph N100. Each node of the execution tree S100 is represented by a combination of the path constraint (upper column) and the variable state (middle column) described above, and further, position information (lower column) indicating the position via the source code is represented. ing. A root node (root node) S101 of the execution tree S100 corresponds to an initial state of execution of the source code. The information processing apparatus adds new nodes to the execution tree S100 each time a variable is updated as the source code is executed.

 実行木S100の生成に際し、情報処理装置は、関数fooの入力変数となる変数の値に対応する記号変数を割り当てる。入力変数となる変数の値とは、関数外部から与えられて、当該関数の動作に影響を与える変数の値であり、関数の引数や関数内でアクセスするグローバル変数を含む。 When generating the execution tree S100, the information processing apparatus assigns a symbol variable corresponding to the value of the variable that becomes the input variable of the function foo. The value of a variable serving as an input variable is a value of a variable that is given from outside the function and affects the operation of the function, and includes a function variable and a global variable that is accessed within the function.

 例示するソースコードC100においては、関数の引数aとグローバル変数gが入力変数となる。本例では、情報処理装置は、変数aとgに「α」と「γ」を記号変数として割り当てている。 In the illustrated source code C100, a function argument a and a global variable g are input variables. In this example, the information processing apparatus assigns “α” and “γ” to the variables a and g as symbolic variables.

 情報処理装置は、構造グラフN100のノードN1に基づき、実行木S100に根ノードS101を生成する。本例では、情報処理装置は、根ノードS101のパス制約(上欄)S101aに、「制約無し」を示す「no condition」を設定し、変数状態(中欄)S101bに、入力変数aとgの値がそれぞれ割り当てられた記号変数αとγであることを示す「a=α,g=γ」を設定している。また、位置情報(下欄)S101cに、ノードN1から取得した位置情報L2を設定する。 The information processing apparatus generates a root node S101 in the execution tree S100 based on the node N1 of the structure graph N100. In this example, the information processing apparatus sets “no condition” indicating “no constraint” in the path constraint (upper column) S101a of the root node S101, and inputs variable a and g in the variable state (middle column) S101b. “A = α, g = γ” is set to indicate that symbol values α and γ are assigned respectively. Further, the position information L2 acquired from the node N1 is set in the position information (lower column) S101c.

 情報処理装置は、構造グラフN100のノードN1の制御フロー上の次ノードN2に基づき処理を実行する。ノードN2は2つの条件付き制御フローN21とN22を持つ条件分岐ノードであり、情報処理装置は、条件付き制御フローN21に対応する子ノードS102を、条件付き制御フローN22に対応する子ノードS105を、それぞれノードS101の子ノードとして生成する。 The information processing apparatus executes processing based on the next node N2 on the control flow of the node N1 of the structure graph N100. The node N2 is a conditional branch node having two conditional control flows N21 and N22. The information processing apparatus includes a child node S102 corresponding to the conditional control flow N21 and a child node S105 corresponding to the conditional control flow N22. Are generated as child nodes of the node S101.

 ノードN2における条件式は「g==0」であり、S101bにおける変数gの変数状態はγであるため、条件付き制御フローN21における分岐条件は「γ=0」と表現できる。そのため、ノードS102のパス制約(上欄)は、S101aにおけるパス制約「制約無し」と合わせて「γ=0」と設定される。 Since the conditional expression in the node N2 is “g == 0” and the variable state of the variable g in S101b is γ, the branch condition in the conditional control flow N21 can be expressed as “γ = 0”. Therefore, the path constraint (upper column) of the node S102 is set to “γ = 0” together with the path constraint “no constraint” in S101a.

 ノードS102の変数状態(中欄)は、if文によって変数状態が変化しないため親ノードS101の変数状態S101bと同一に設定される。また、位置情報(下欄)は、親ノードS101の位置情報S101cに加えて、ノードN2の位置情報(L4)が追加され「L2,4」となり、ソースコードの2行目と4行目を経由してきたことを意味する。 The variable state (middle column) of the node S102 is set to be the same as the variable state S101b of the parent node S101 because the variable state is not changed by the if statement. In addition, the position information (lower column) is “L2, 4” by adding the position information (L4) of the node N2 to the position information S101c of the parent node S101, and the second and fourth lines of the source code. Means you have been through.

 条件付き制御フローN22における分岐条件は、制御フローN22がif文の条件が成立しなかった場合に対応するフローであることから、「¬(γ=0)」と表現できる。そのため、ノードS105のパス制約(上欄)は、S101aにおけるパス制約「制約無し」と合わせて「¬(γ=0)」と設定される。 The branch condition in the conditional control flow N22 can be expressed as “¬ (γ = 0)” because the control flow N22 is a flow corresponding to the case where the condition of the if statement is not satisfied. Therefore, the path constraint (upper column) of the node S105 is set to “¬ (γ = 0)” together with the path constraint “no constraint” in S101a.

 ノードS105における変数状態(中欄)は、if文によって変数状態が変化しないため親ノードS101の変数状態S101bと同一に設定される。また、位置情報(下欄)は、親ノードS101の位置情報S101cに加えて、ノードN2の位置情報(L4)が追加され「L2,4」となる。 The variable state (middle column) in the node S105 is set to be the same as the variable state S101b of the parent node S101 because the variable state is not changed by the if statement. Further, the position information (lower column) is “L2, 4” by adding the position information (L4) of the node N2 to the position information S101c of the parent node S101.

 情報処理装置は、ノードN2の制御フローN21上の次ノードであるN3に基づき処理を実行する。情報処理装置は、ノードN3に対応する実行木S100におけるノードとしてS102の子ノードS103を生成する。 The information processing apparatus executes processing based on N3 which is the next node on the control flow N21 of the node N2. The information processing apparatus generates a child node S103 of S102 as a node in the execution tree S100 corresponding to the node N3.

 ノードS103においては、条件分岐が無いため、パス制約(上欄)はS102と同一に設定する。また、ノードN3において変数rに値0を代入しているため変数状態(中欄)に「r=0」を追加する。位置情報(下欄)にはS102における位置情報にノードN3の位置情報である「L5」を追加する。 In node S103, since there is no conditional branch, the path constraint (upper column) is set the same as S102. Since the value 0 is substituted for the variable r at the node N3, “r = 0” is added to the variable state (middle column). In the position information (lower column), “L5” that is the position information of the node N3 is added to the position information in S102.

 情報処理装置は、ノードN3の制御フロー上の次ノードであるN5に基づき処理を実行する。ノードN5に対応する実行木S100におけるノードとしてS103の子ノードS104を生成する。ノードN5は変数rを返り値とするreturn文に対応しているため、変数状態(中欄)には、返り値を表わすこととする変数Rに対して変数rの現在の値である0を割り当てた「R=0」を追加する。return文により関数の実行は終わるため、情報処理装置は、実行木S100における、この枝の生成を終了し、まだ生成の終わっていない枝の生成へと移行する。 The information processing apparatus executes processing based on N5 which is the next node on the control flow of the node N3. A child node S104 of S103 is generated as a node in the execution tree S100 corresponding to the node N5. Since the node N5 corresponds to the return statement whose return value is the variable r, the variable state (in the middle column) is set to 0, which is the current value of the variable r, for the variable R representing the return value. The assigned “R = 0” is added. Since the execution of the function is terminated by the return statement, the information processing apparatus ends the generation of this branch in the execution tree S100, and shifts to generation of a branch that has not yet been generated.

 情報処理装置は、N2の制御フローN22上の次ノードであるN4に基づき処理を実行する。ノードN4は2つの条件付き制御フローN41とN42を持つ条件分岐ノードであり、情報処理装置は、条件付き制御フローN41に対応する子ノードS106を、条件付き制御フローN42に対応する子ノードS110を、それぞれノードS105の下に生成する。 The information processing apparatus executes processing based on N4 which is the next node on the control flow N22 of N2. The node N4 is a conditional branch node having two conditional control flows N41 and N42, and the information processing apparatus displays a child node S106 corresponding to the conditional control flow N41 and a child node S110 corresponding to the conditional control flow N42. , Respectively, under the node S105.

 ノードN4におけるif文の条件式は「a>0」であり、変数状態よりaに対応する値はαであるため、条件付き制御フローN41における分岐条件は「α>0」と表現される。そのため、S106におけるパス制約(上欄)はS105におけるパス制約「¬(γ=0)」と「α>0」との論理積である「¬(γ=0)∧(α>0)」を設定する。 Since the conditional expression of the “if” statement at the node N4 is “a> 0” and the value corresponding to “a” is α from the variable state, the branch condition in the conditional control flow N41 is expressed as “α> 0”. Therefore, the path constraint (upper column) in S106 is “を (γ = 0) ∧ (α> 0)” which is the logical product of the path constraint “¬ (γ = 0)” and “α> 0” in S105. Set.

 以下、情報処理装置は、各枝に対して、すべての枝の生成が終了するまでに上記の処理を繰り返す。 Hereinafter, the information processing apparatus repeats the above processing until the generation of all branches is completed for each branch.

 ノードN6に対する処理では、情報処理装置は、ノードS107の子ノードS108を生成している。ノードN6では変数gの値をg-1に更新している。この時、変数gに対応する値はS107の変数状態(中欄)からγであると分かる。そこで、子ノードS108では、情報処理装置は、変数gに対する変数状態(中欄)を「g=γ―1」に更新する。このように、記号変数を含む計算に対しては具体的な値ではなく式のままの形で変数状態を保持する。 In the process for the node N6, the information processing apparatus generates a child node S108 of the node S107. Node N6 updates the value of variable g to g-1. At this time, the value corresponding to the variable g is found to be γ from the variable state (middle column) in S107. Therefore, in the child node S108, the information processing apparatus updates the variable state (middle column) for the variable g to “g = γ−1”. In this way, for calculations involving symbolic variables, the variable state is retained in the form of an expression rather than a specific value.

 情報処理装置は、上記の処理によって、最終的に図2に示す構造グラフN100から図3に示すような実行木S100を得る。記号実行においては取り得る全ての制御フローが網羅されるように条件分岐に応じた子ノードが実行木に生成される。 The information processing apparatus finally obtains an execution tree S100 as shown in FIG. 3 from the structure graph N100 shown in FIG. 2 by the above processing. In symbol execution, child nodes corresponding to conditional branches are generated in the execution tree so that all possible control flows are covered.

 実行木における葉ノードは、ソースコードの入力値に対する条件(パス制約)と、出力変数の状態(変数状態)の組の集合を求めることであるということができる。以下の説明において、記号実行が終了した時点における実行木の葉ノードを「スナップショット」と称し、スナップショットの集合ことを「記号実行サマリ」と称する。ただし、変数状態に含まれる変数のうち、ローカル変数(関数の引数を含む)は関数の実行完了時点で破棄されるため、スナップショットおよび記号実行サマリからローカル変数の変数状態は除外することとする。 It can be said that a leaf node in an execution tree is to obtain a set of a set of a condition (path constraint) for an input value of a source code and a state (variable state) of an output variable. In the following description, the leaf node of the execution tree at the time when the symbol execution is completed is referred to as “snapshot”, and the collection of snapshots is referred to as “symbol execution summary”. However, among the variables included in the variable state, local variables (including function arguments) are discarded when the function execution is completed, so the variable state of the local variable is excluded from the snapshot and symbol execution summary. .

 実行木S100における葉ノードはS104、S109,S113の3ノードであり、これらはそれぞれスナップショットとなり、これらの集合が記号実行サマリS120となる。ただし、ローカル変数である変数rおよびaの変数状態は除外する。 The leaf nodes in the execution tree S100 are the three nodes S104, S109, and S113, which are snapshots, and these sets are the symbol execution summary S120. However, the variable states of variables r and a which are local variables are excluded.

 本例では、C言語で記述されたソースコードを用いて記号実行を説明したが、C言語に限定されず他のプログラミング言語を用いて記述されたソースコードに対しても同様に実施可能である。 In this example, the symbol execution is described using the source code written in the C language. However, the present invention is not limited to the C language, and can be similarly applied to the source code written using another programming language. .

 以下、図4から図14を用いて、実施例1のソースコード等価性検証装置1000の構成と処理について説明する。 Hereinafter, the configuration and processing of the source code equivalence verification apparatus 1000 according to the first embodiment will be described with reference to FIGS.

 図4は、本実施例のソースコード等価性検証装置のハードウェア構成である。本実施例のソースコード等価性検証装置は、例えば、図4に示されるような一般的なコンピュータで実現される。ソースコード等価性検証装置1000は、CPU(Central Processing Unit)101、主記憶装置102、ネットワークI/F103、グラフィックI/F104、入出力I/F105、補助記憶装置I/F106が、バスにより結合された形態になっている。 FIG. 4 shows the hardware configuration of the source code equivalence verification apparatus of this embodiment. The source code equivalence verification apparatus of the present embodiment is realized by a general computer as shown in FIG. 4, for example. The source code equivalence verification apparatus 1000 includes a CPU (Central Processing Unit) 101, a main storage device 102, a network I / F 103, a graphic I / F 104, an input / output I / F 105, and an auxiliary storage device I / F 106 connected by a bus. It has become a form.

 CPU101は、ソースコード等価性検証装置1000の各部を制御し、主記憶装置102にソースコード等価性検証プログラム200をロードして実行する。 The CPU 101 controls each part of the source code equivalence verification apparatus 1000, loads the source code equivalence verification program 200 to the main storage device 102, and executes it.

 主記憶装置102は、通常、RAMなどの揮発メモリで構成され、CPU101が実行するプログラム、参照するデータが補助記憶装置などからロードされて、記憶される。 The main storage device 102 is usually composed of a volatile memory such as a RAM, and a program executed by the CPU 101 and data to be referenced are loaded from an auxiliary storage device or the like and stored.

 ネットワークI/F103は、外部ネットワーク150と接続するためのインタフェースである。 The network I / F 103 is an interface for connecting to the external network 150.

 グラフィックI/F104は、LCD(Liquid Crystal Display)などの表示装置120を接続するためのインタフェースである。 The graphic I / F 104 is an interface for connecting a display device 120 such as an LCD (Liquid Crystal Display).

 入出力I/F105は、入出力装置を接続するためのインタフェースである。図4の例では、キーボード131とポインティングデバイスのマウス132が接続されている。 The input / output I / F 105 is an interface for connecting an input / output device. In the example of FIG. 4, a keyboard 131 and a mouse 132 as a pointing device are connected.

 補助記憶装置I/F106は、HDD(Hard Disk Drive)141やDVD(Digital Versatile Disk)ドライブ装置142などの補助記憶装置を接続するためのインタフェースである。 The auxiliary storage device I / F 106 is an interface for connecting an auxiliary storage device such as an HDD (Hard Disk Drive) 141 or a DVD (Digital Versatile Disk) drive device 142.

 HDD141は、大容量の記憶容量を有しており、本実施例の処理を実行するためのソースコード等価性検証プログラム200が格納されている。 The HDD 141 has a large storage capacity, and stores a source code equivalence verification program 200 for executing the processing of this embodiment.

 DVDドライブ装置142は、DVDやCDなどの光学ディスクにデータを書き込んだり、光学ディスクからデータを読み込んだりする装置であり、ソースコード等価性検証プログラム200は、例えば、CD-ROMにより提供されたものをインストールすることができる。 The DVD drive device 142 is a device that writes data to or reads data from an optical disk such as a DVD or a CD. The source code equivalence verification program 200 is provided by, for example, a CD-ROM. Can be installed.

 本実施例のテストデータ生成装置1000は、上記のようなコンピュータに、ソースコード等価性検証プログラム200をインストールして、各機能を実行するものである。 The test data generation apparatus 1000 of the present embodiment installs the source code equivalence verification program 200 in the computer as described above and executes each function.

 図5は、本実施例のソースコード等価性検証装置のソフトウェア構成である。ソースコード等価性検証装置1000で実行するソースコード等価性検証プログラム200は、ソースコード読込みモジュール201、構造グラフ生成モジュール202、記号実行計算モジュール203、等価性検証式生成モジュール204、等価性検証式検証モジュール205、および検証結果表示モジュール206を含む。 FIG. 5 shows a software configuration of the source code equivalence verification apparatus of the present embodiment. A source code equivalence verification program 200 executed by the source code equivalence verification apparatus 1000 includes a source code reading module 201, a structure graph generation module 202, a symbol execution calculation module 203, an equivalence verification expression generation module 204, and an equivalence verification expression verification. A module 205 and a verification result display module 206 are included.

 なお、プログラム等価性検証プログラム200は、OS(Operating System)上で動作するアプリケーションソフトウェアであり、ソースコード等価性検証装置のソフトウェア構成として、OSやライブラリプログラムも含むが図5では、省略している。 The program equivalence verification program 200 is application software that runs on an OS (Operating System). The software configuration of the source code equivalence verification device includes an OS and a library program, but is omitted in FIG. .

 ソースコード読込みモジュール201は、検証対象の変更前ソースコードと変更後ソースコードとをHDDや他の計算機から読込み、記憶部に格納するモジュールである。 The source code reading module 201 is a module that reads the pre-change source code and the post-change source code to be verified from the HDD or another computer and stores them in the storage unit.

 構造グラフ生成モジュール202は、ソースコード(たとえば、前述したC100)の字句解析・構文解析を行い、制御フローを抽出することにより、構造グラフ(たとえば、前述したN100)を生成するモジュールである。 The structure graph generation module 202 is a module that generates a structure graph (for example, N100 described above) by performing lexical analysis / syntactic analysis of a source code (for example, C100 described above) and extracting a control flow.

 記号実行計算モジュール203は、構造グラフ生成モジュール202が生成した構造グラフに基づき、記号実行を行って実行木(たとえば、前述したS100)を計算し、その葉ノードを集めた記号実行サマリ(たとえば、前述したS120)を生成するモジュールである。 The symbol execution calculation module 203 performs symbol execution based on the structure graph generated by the structure graph generation module 202 to calculate an execution tree (for example, S100 described above), and collects the leaf nodes of the symbol execution summary (for example, for example, This module generates S120) described above.

 等価性検証式生成モジュール204は、記号実行計算モジュール203が生成した、変更前ソースコードの記号実行サマリおよび変更後ソースコードの記号実行サマリから、両者の等価性を判定するための検証論理式である等価性検証式を生成するモジュールである。 The equivalence verification expression generation module 204 is a verification logical expression for determining equivalence between the symbol execution summary of the source code before change and the symbol execution summary of the source code after change generated by the symbol execution calculation module 203. This module generates a certain equivalence verification formula.

 等価性検証式検証モジュール205は、等価性検証式生成モジュール204が生成した等価性検証式をSAT(SATisfiability)ソルバやSMT(Satisfiability Modulo Theories)ソルバを用いてグラフ理論における充足可能性問題として解くモジュールである。 The equivalence verification formula verification module 205 is a module that solves the equivalence verification formula generated by the equivalence verification formula generation module 204 as a satisfiability problem in graph theory using a SAT (SAT fidelity) solver or an SMT (Satisfiability Modulo Theories) solver. It is.

 検証結果生成モジュール206は、等価性検証式検証モジュール205が出力した検証結果や記号実行サマリ、ソースコードの情報を用いて検証結果レポートを生成し、表示または通知するモジュールである。 The verification result generation module 206 is a module that generates a verification result report using the verification result, symbol execution summary, and source code information output from the equivalence verification expression verification module 205, and displays or notifies the verification result report.

 図6は、ソースコード等価性検証装置1000の機能構成図を示す。制御部110は、図4のCPU101、主記憶装置102により実現し、記憶部140は主に図4のHDD141により実現するが、主記憶装置102を含めることもある。入力装置130は、図4の入出力I/F105、キーボード131、マウス132などを含み、さらに補助記憶装置I/F106を介してDVDドライブ装置142から読込む構成を含めてもよい。出力装置121は、グラフィックI/F104、表示装置120などを含み、さらに補助記憶装置I/F106を介してDVDドライブ装置142へ書き込む構成を含めてもよい。通信部103は、図4のネットワークI/F103を表わすが、ネットワーク150を介して例えば外部計算機160と接続されている。図6の制御部110および記憶部140の詳細は、図7を用いて説明する。 FIG. 6 shows a functional configuration diagram of the source code equivalence verification apparatus 1000. The control unit 110 is realized by the CPU 101 and the main storage device 102 in FIG. 4, and the storage unit 140 is mainly realized by the HDD 141 in FIG. 4, but may include the main storage device 102. The input device 130 includes the input / output I / F 105, the keyboard 131, the mouse 132, and the like of FIG. 4, and may further include a configuration for reading from the DVD drive device 142 via the auxiliary storage device I / F 106. The output device 121 includes a graphic I / F 104, a display device 120, and the like, and may further include a configuration for writing to the DVD drive device 142 via the auxiliary storage device I / F 106. The communication unit 103 represents the network I / F 103 in FIG. 4 and is connected to, for example, an external computer 160 via the network 150. Details of the control unit 110 and the storage unit 140 of FIG. 6 will be described with reference to FIG.

 図7は、ソースコード等価性検証装置1000の制御部110および記憶部140内の構成およびデータフローを示す。ソースコード入力部111は、検証対象とする変更前ソースコード301および変更後ソースコード302を読込み、変更前/後ソースコード記憶領域201にそれぞれ格納する。 FIG. 7 shows a configuration and a data flow in the control unit 110 and the storage unit 140 of the source code equivalence verification apparatus 1000. The source code input unit 111 reads the pre-change source code 301 and the post-change source code 302 to be verified, and stores them in the pre-change / post-change source code storage area 201.

 本実施例では、変更前ソースコード301と変更後ソースコード302がC言語で記述された例を用いて説明しているが、他の言語にも対応した構造グラフ生成部112および記号実行計算部113を用いることにより、他のプログラミング言語で記述されたソースコードを用いることも可能である。また、変更前ソースコード301と変更後ソースコード302とで異なるプログラミング言語を用いても良い。 In this embodiment, the pre-change source code 301 and the post-change source code 302 are described using an example described in C language. However, the structure graph generation unit 112 and the symbol execution calculation unit corresponding to other languages are also described. By using 113, it is also possible to use source code written in another programming language. Different programming languages may be used for the source code 301 before change and the source code 302 after change.

 構造グラフ生成部112は、変更前/後ソースコード記憶領域201に格納されている、変更前ソースコードおよび変更後ソースコードのそれぞれのソースコード解析を実行し、その解析結果である変更前構造グラフおよび変更後構造グラフを変更前/後構造グラフ記憶領域202に格納する。 The structure graph generation unit 112 executes source code analysis of each of the pre-change source code and the post-change source code stored in the pre-change / post-source code storage area 201, and the pre-change structure graph which is the analysis result The post-change structure graph is stored in the pre-change / post-structure graph storage area 202.

 記号実行計算部113は、変更後構造グラフを変更前/後構造グラフ記憶領域202に格納されている、変更前/後構造グラフのそれぞれを記号実行し、その計算結果(実行結果)である記号実行サマリを変更前/後記号実行結果記憶領域203に格納する。 The symbol execution calculation unit 113 performs symbol execution on each of the pre-change / post-structure graphs stored in the pre-change / post-structure graph storage area 202 for the post-change structure graph, and a symbol that is a calculation result (execution result) The execution summary is stored in the before / after symbol execution result storage area 203.

 等価性検証式生成部114は、変更前/後記号実行結果記憶領域203に格納されている、変更前/後記号実行サマリから、変更前および変更後の両者の等価性を検証するための論理式である等価性検証式を生成し、等価性検証式記憶領域204に格納する。 The equivalence verification expression generation unit 114 uses a logic for verifying equivalence of both before and after the change from the before / after change execution summary stored in the before / after change execution result storage area 203. An equivalence verification expression that is an expression is generated and stored in the equivalence verification expression storage area 204.

 等価性検証式検証部115は、等価性検証式記憶領域204に格納されている等価性検証式の検証を実行し、検証式の検証結果を等価性検証式結果記憶領域205に格納する。 The equivalence verification formula verification unit 115 executes verification of the equivalence verification formula stored in the equivalence verification formula storage area 204 and stores the verification result of the verification formula in the equivalence verification formula result storage area 205.

 検証結果生成部116は、等価性検証式の検証結果、記号実行サマリ、およびソースコードに関する情報を用いて、検証結果レポート310を生成し、検証結果記憶領域206に格納するとともに出力装置121を用いて画面に表示する、または、通信部103を用いて外部計算機160に送信する。 The verification result generation unit 116 generates a verification result report 310 using information on the verification result of the equivalence verification formula, the symbol execution summary, and the source code, stores the verification result report 310 in the verification result storage area 206, and uses the output device 121. Displayed on the screen or transmitted to the external computer 160 using the communication unit 103.

 以上の説明から明らかなように、制御部110に含まれる各部の動作は、図5に示したソースコード等価性検証プログラムの各モジュールをソースコード等価性検証装置1000が実行することによって実現される。 As is clear from the above description, the operation of each unit included in the control unit 110 is realized by the source code equivalence verification apparatus 1000 executing each module of the source code equivalence verification program shown in FIG. .

 図8は、ソースコード等価性検証の処理フローチャートである。変更前ソースコードとして図1に示す変更前ソースコードC100を、変更後ソースコードとしてC100と等価に変更した図9に示す変更後ソースコードC200を入力した場合を例として説明する。 FIG. 8 is a process flowchart of source code equivalence verification. An example will be described in which the pre-change source code C100 shown in FIG. 1 is input as the pre-change source code, and the post-change source code C200 shown in FIG.

 ソースコード入力部111は、検証対象とする変更前ソースコード301を読込み、変更前/後ソースコード記憶領域201にそれぞれ格納する。(P110)。構造グラフ生成部112は、変更前/後ソースコード記憶領域201に格納されている変更前ソースコードのソースコード解析を実行し、その解析結果である変更前構造グラフを生成し、変更前/後構造グラフ記憶領域202に格納する(P120)。記号実行計算部113は、変更前/後構造グラフ記憶領域202に格納されている変更前構造グラフに対して記号実行し、その実行結果を変更前記号実行サマリとして生成し、変更前/後記号実行結果記憶領域203に格納する(P130)。 The source code input unit 111 reads the pre-change source code 301 to be verified and stores it in the pre-change / post-source code storage area 201. (P110). The structure graph generation unit 112 performs source code analysis of the pre-change source code stored in the pre-change / post-change source code storage area 201, generates a pre-change structure graph as a result of the analysis, and before / after the change The data is stored in the structure graph storage area 202 (P120). The symbol execution calculation unit 113 executes symbol execution with respect to the pre-change structure graph stored in the pre-change / post-structure graph storage area 202, generates the execution result as the change issue execution summary, and displays the pre-change / post-change symbols. The result is stored in the execution result storage area 203 (P130).

 変更後ソースコードに対しても同様に、ソースコード入力部111の処理(P111)、構造グラフ生成部112の処理(P121)、および記号実行計算部113の処理(P131)を実行し、変更後記号実行サマリを変更前/後記号実行結果記憶領域203に格納する。 Similarly, the process of the source code input unit 111 (P111), the process of the structure graph generation unit 112 (P121), and the process of the symbol execution calculation unit 113 (P131) are executed for the changed source code, and The symbol execution summary is stored in the before / after symbol execution result storage area 203.

 変更前ソースコードに対する処理ステップP110、P120、P130と、変更後ソースコードに対する処理ステップP111、P121、P131は、独立に実行することができるため、両者を並列に処理しても良い。 Since the processing steps P110, P120, and P130 for the source code before the change and the processing steps P111, P121, and P131 for the source code after the change can be executed independently, they may be processed in parallel.

 また、以前に同じ内容のソースコードに対して処理を実行した場合には、変更前/後記号実行結果記憶領域203に格納されている以前の処理結果を再利用することにより、構造グラフ生成と記号実行計算を省略することができる。 In addition, when processing is executed on the source code having the same content before, the structure graph generation and re-use can be performed by reusing the previous processing result stored in the pre-change / post-symbol execution result storage area 203. Symbolic execution calculations can be omitted.

 等価性検証式生成部114は、変更前ソースコードの記号実行サマリと変更後ソースコードの記号実行サマリを用いて等価性検証式を生成する(P140)。図9は、変更前ソースコードC100から変更した変更後ソースコードC200である。図10は、変更後ソースコードC200から生成した記号実行サマリS220である。図1に示す変更前ソースコードC100から生成した図3に示す記号実行サマリS120と、図9に示す変更後ソースコードC200から生成した図10に示す記号実行サマリS220とを用いて、等価性検証式の生成について、具体的に説明する。 The equivalence verification formula generator 114 generates an equivalence verification formula using the symbol execution summary of the source code before the change and the symbol execution summary of the source code after the change (P140). FIG. 9 shows a post-change source code C200 that is changed from the pre-change source code C100. FIG. 10 shows a symbol execution summary S220 generated from the changed source code C200. Using the symbol execution summary S120 shown in FIG. 3 generated from the source code C100 before change shown in FIG. 1 and the symbol execution summary S220 shown in FIG. 10 generated from the source code C200 after change shown in FIG. The generation of the expression will be specifically described.

 記号実行サマリの各スナップショットに対して、パス制約と各変数状態の等号条件との連言を取ることによりスナップショット制約式を生成する。 ∙ For each snapshot in the symbol execution summary, a snapshot constraint expression is generated by taking the conjunction of the path constraint and the equal sign condition of each variable state.

 例えば、スナップショットS104、S109、S113に対しては、それぞれ(γ=0)∧(g=γ)∧(R=0)、¬(γ=0)∧(α>0)∧(g=γ-1)∧(R=α)、¬(γ=0)∧¬(α>0)∧(g=γ-1)∧(R=―α)という制約式が生成される。この際、前述のようにローカル変数である変数rおよび変数aに対する変数状態の等号制約は除外される。 For example, for snapshots S104, S109, and S113, (γ = 0) ∧ (g = γ) ∧ (R = 0), ¬ (γ = 0) ∧ (α> 0) ∧ (g = γ), respectively. -1) Constraint expressions such as ∧ (R = α), ¬ (γ = 0) ∧¬ (α> 0) ∧ (g = γ-1) ∧ (R = -α) are generated. At this time, as described above, the equality constraint of the variable state for the variables r and a which are local variables is excluded.

 次に、各スナップショット制約式の選言を取ることにより、記号実行サマリ制約式を生成する。たとえば、記号実行サマリS120に対する記号実行サマリ制約式は、{(γ=0)∧(g=γ)∧(R=0)}∨{¬(γ=0)∧(α>0)∧(g=γ-1)∧(R=α)}∨{¬(γ=0)∧¬(α>0)∧(g=γ-1)∧(R=―α)}となる。 Next, a symbol execution summary constraint expression is generated by taking a disjunction of each snapshot constraint expression. For example, the symbol execution summary constraint expression for the symbol execution summary S120 is {(γ = 0) ∧ (g = γ) ∧ (R = 0)} ∨ {¬ (γ = 0) ∧ (α> 0) ∧ (g = Γ−1) ∧ (R = α)} ∨ {¬ (γ = 0) ∧¬ (α> 0) ∧ (g = γ−1) ∧ (R = −α)}.

 変更後ソースコードから生成された変更後記号実行サマリS220に対しても同様にして、記号実行サマリ制約式{(γ=0)∧(g’=γ)∧(R’=0)}∨{¬(γ=0)∧(α<0)∧(g’=γ-1)∧(R’=-α)}∨{¬(γ=0)∧¬(α<0)∧(g’=γ-1)∧(R’=α)}と求まる。ただし、変更後記号実行サマリ制約式中の出力変数gとRに対しては、変更前記号実行サマリ制約式中の変数名との衝突を回避するため、それぞれg’とR’に置換している。 Similarly, the symbol execution summary constraint expression {(γ = 0) ∧ (g ′ = γ) ∧ (R ′ = 0)} ∨ {is also applied to the post-change symbol execution summary S220 generated from the changed source code. ¬ (γ = 0) ∧ (α <0) ∧ (g ′ = γ−1) ∧ (R ′ = − α)} ∨ {¬ (γ = 0) ∧¬ (α <0) ∧ (g ′ = γ−1) ∧ (R ′ = α)}. However, the output variables g and R in the changed symbol execution summary constraint expression are replaced with g ′ and R ′, respectively, in order to avoid a conflict with the variable name in the change execution summary constraint expression. Yes.

 変更前ソースコードと変更後ソースコードが等価である時、任意の入力変数に対して出力変数が等しくなるため、対応する出力変数間の等号制約の連言が常に成立する。そこで、本式の否定と変更前記号実行サマリ制約式と変更後記号実行サマリ制約式との連言を取り、これを等価性検証式とし、等価性検証式記憶領域204に格納する。 ∙ When the source code before change and the source code after change are equivalent, the output variable becomes equal to any input variable, so the conjunction of equality constraints between corresponding output variables always holds. Accordingly, negation of this expression and change The above-mentioned symbol execution summary constraint expression and the post-change symbol execution summary constraint expression are taken together as an equivalence verification expression and stored in the equivalence verification expression storage area 204.

 この等価性検証式が充足不可能である場合、任意の入力変数に対して出力変数が等しいことを意味するため、両ソースコードが等価であると判定される。また、充足可能な場合には、出力変数が異なるケースがあることを意味するため、非等価であると判定される。 場合 If this equivalence verification formula is not satisfactory, it means that the output variable is equal to any input variable, so it is determined that both source codes are equivalent. Further, if it can be satisfied, it means that there are cases where the output variables are different, so it is determined that they are not equivalent.

 本例では(R=R’)∧(g=g’)の否定と、変更前記号実行サマリ制約式と、変更後記号実行サマリ制約式との連言である、¬((R=R’)∧(g=g’))∧((γ=0)∧(g=γ)∧(R=0)∨¬(γ=0)∧(α>0)∧(g=γ-1)∧(R=α)∨¬(γ=0)∧¬(α>0)∧(g=γ-1)∧(R=―α))∧((γ=0)∧(g’=γ)∧(R’=0)∨¬(γ=0)∧(α<0)∧(g’=γ-1)∧(R’=-α)∨¬(γ=0)∧¬(α<0)∧(g’=γ-1)∧(R’=α))が等価性検証式である。 In this example, (R = R ′) ∧ (g = g ′) is negated, and the modified sign execution summary constraint expression and the modified symbol execution summary constraint expression are joint statements of ¬ ((R = R ′ ) ∧ (g = g ′)) ∧ ((γ = 0) ∧ (g = γ) ∧ (R = 0) ∨¬ (γ = 0) ∧ (α> 0) ∧ (g = γ−1) ∧ (R = α) ∨¬ (γ = 0) ∧¬ (α> 0) ∧ (g = γ−1) ∧ (R = −α)) ∧ ((γ = 0) ∧ (g ′ = γ) ∧ (R ′ = 0) ∨¬ (γ = 0) ∧ (α <0) ∧ (g ′ = γ−1) ∧ (R ′ = − α) ∨¬ (γ = 0) ∧¬ (α <0) ∧ (g ′ = γ−1) ∧ (R ′ = α)) is an equivalence checking formula.

 等価性検証式検証部115は、SATソルバやSMTソルバ等を用いて、等価性検証式生成部114が生成した等価性検証式の充足可能性を判定する(P150)。等価性検証式検証部115は、等価性検証式の充足可能か不可能かの判定結果と、充足可能な場合にはソルバが出力する充足するような変数の値の例である反例とを検証結果として等価性検証式検証結果記憶領域205に格納する。本例では、等価性検証式が充足不可能と判定されるため、充足不可能と格納される。 The equivalence verification formula verification unit 115 determines satisfiability of the equivalence verification formula generated by the equivalence verification formula generation unit 114 using a SAT solver, an SMT solver, or the like (P150). The equivalence verification formula verification unit 115 verifies whether the equivalence verification formula is satisfiable or not, and a counter example that is an example of a satisfiable variable value that is output if the equivalence verification formula is satisfiable. As a result, it is stored in the equivalence verification formula verification result storage area 205. In this example, since it is determined that the equivalence checking expression is unsatisfiable, it is stored as unsatisfiable.

 検証結果生成部116は、等価性検証式検証部115による検証結果に基づき、たとえば、図11に示すような検証結果レポート500を生成する(P160)。検証結果レポート500には、検証結果表示510として、等価性検証式検証結果が充足不可能な場合には「等価」と、充足可能な場合には「非等価」と表示される。本例では、等価性検証式が充足不可能と格納されているため検証結果510は「等価」と表示されている。 The verification result generation unit 116 generates, for example, a verification result report 500 as shown in FIG. 11 based on the verification result by the equivalence verification formula verification unit 115 (P160). In the verification result report 500, as the verification result display 510, “equivalent” is displayed when the equivalence verification expression verification result cannot be satisfied, and “non-equivalent” when it can be satisfied. In this example, since the equivalence verification formula is stored as being unsatisfiable, the verification result 510 is displayed as “equivalent”.

 また、検証結果レポート500は、変更前/後ソースコード記憶領域201に格納されているソースコードを用いて、変更前ソースコード521および変更後ソースコード522の表示を含んでも良い。さらに、検証結果レポート500は、変更前/後記号実行結果記憶領域203に格納されている記号実行サマリ情報を用いて、変更前記号実行サマリ531および変更後記号実行サマリ532の表示を含んでも良い。図11における記号実行サマリ表示531および532においては、スナップショットごとにそのパス制約と変数状態とを一行で表示している。 Further, the verification result report 500 may include a display of the source code 521 before the change and the source code 522 after the change using the source code stored in the before / after source code storage area 201. Further, the verification result report 500 may include a display of the changed symbol execution summary 531 and the changed symbol execution summary 532 using the symbol execution summary information stored in the before / after symbol execution result storage area 203. . In the symbol execution summary displays 531 and 532 in FIG. 11, the path constraints and variable states are displayed in one line for each snapshot.

 次に、図8に示すソースコード等価性検証の処理に関して、変更前ソースコードとして図1に示す変更前ソースコードC100を、C100と非等価な変更である変更後ソースコードとして図12に示す変更後ソースコードC300を入力した場合を例として説明する。 Next, regarding the source code equivalency verification process shown in FIG. 8, the change source code C100 shown in FIG. 1 as the source code before change is changed to the source code C100 shown in FIG. A case where the post source code C300 is input will be described as an example.

 制御部110の各処理は上述の通りであり、記号実行計算部113の処理(P131)により、変更後ソースコードC300からは図13に示すような実行木S300および記号実行サマリS320が生成される。 Each process of the control unit 110 is as described above, and an execution tree S300 and a symbol execution summary S320 as shown in FIG. 13 are generated from the changed source code C300 by the process (P131) of the symbol execution calculation unit 113. .

 記号実行サマリS320に対応する記号実行サマリ制約式は(γ=0)∧(g’=γ)∧(R’=0)∨¬(γ=0)∧(α<0)∧(g’=γ+1)∧(R’=-α)∨¬(γ=0)∧¬(α<0)∧(g’=γ+1)∧(R’=α)と求まる。 The symbol execution summary constraint expression corresponding to the symbol execution summary S320 is (γ = 0) ∧ (g ′ = γ) ∧ (R ′ = 0) ∨¬ (γ = 0) ∧ (α <0) ∧ (g ′ = γ + 1) ∧ (R ′ = − α) ∨¬ (γ = 0) ∧¬ (α <0) ∧ (g ′ = γ + 1) ∧ (R ′ = α).

 そのため、等価性検証式生成処理ステップP140が生成する等価性検証式は、¬((R=R’)∧(g=g’))∧((γ=0)∧(g=γ)∧(R=0)∨¬(γ=0)∧(α>0)∧(g=γ-1)∧(R=α)∨¬(γ=0)∧¬(α>0)∧(g=γ-1)∧(R=―α))∧((γ=0)∧(g’=γ)∧(R’=0)∨¬(γ=0)∧(α<0)∧(g’=γ+1)∧(R’=-α)∨¬(γ=0)∧¬(α<0)∧(g’=γ+1)∧(R’=α))となる。 Therefore, the equivalence verification formula generated by the equivalence verification formula generation processing step P140 is ¬ ((R = R ′) ∧ (g = g ′)) ∧ ((γ = 0) ∧ (g = γ) ∧ ( R = 0) ∨¬ (γ = 0) ∧ (α> 0) ∧ (g = γ−1) ∧ (R = α) ∨¬ (γ = 0) ∧¬ (α> 0) ∧ (g = γ −1) ∧ (R = −α)) ∧ ((γ = 0) = (g ′ = γ) ∧ (R ′ = 0) ∨¬ (γ = 0) ∧ (α <0) ∧ (g ′ = γ + 1) ∧ (R ′ = − α) ∨¬ (γ = 0) ∧¬ (α <0) ∧ (g ′ = γ + 1) ∧ (R ′ = α)).

 価性検証式検証部115は、上記の等価性検証式の充足可能性をSATソルバ等により判定することにより、充足可能という判定と、例えばα=1、γ=1、R=1、g=0、R’=1、g’=2という反例が得られるので、それらを検証結果として格納する。 The valence verification formula verification unit 115 determines whether the above equivalence verification formula is satisfiable by using a SAT solver or the like, for example, α = 1, γ = 1, R = 1, g = Since counterexamples of 0, R ′ = 1, and g ′ = 2 are obtained, these are stored as verification results.

 検証結果生成部116は、たとえば図14に示すような検証結果レポート550を生成する。 The verification result generation unit 116 generates a verification result report 550 as shown in FIG.

 検証結果レポート550には、等価性検証式検証結果が充足可能であるため検証結果表示560として「非等価」が表示される。また、変更前ソースコード571および変更後ソースコード572の表示や、変更前記号実行サマリ581および変更後記号実行サマリ582の表示を含んでも良い。 In the verification result report 550, since the equivalence verification formula verification result can be satisfied, “not equivalent” is displayed as the verification result display 560. Moreover, the display of the source code 571 before the change and the source code 572 after the change and the display of the changed code execution summary 581 and the changed symbol execution summary 582 may be included.

 さらに、検証結果レポート550は、等価性検証式検証結果記憶領域205に格納されている反例情報を用いて、非等価となるような反例情報590の表示を含んでも良い。 Furthermore, the verification result report 550 may include a display of counterexample information 590 that is not equivalent using counterexample information stored in the equivalence verification formula verification result storage area 205.

 反例情報590では、反例に対して、入力変数、変更前ソースコードの出力変数、変更後ソースコードの出力変数に分類し、反例として求められた値を表示している。変更前出力変数と変更後出力変数で値が異なる変数に対しては、下線を付す等により強調表示させても良い。この表示により、開発者は具体的に非等価となる入力変数の値、および、その時の変更前、変更後それぞれの出力変数の値を知ること可能となる。 In the counterexample information 590, the counterexample is classified into an input variable, an output variable of the source code before change, and an output variable of the source code after change, and a value obtained as a counterexample is displayed. Variables having different values between the output variable before change and the output variable after change may be highlighted by underlining. By this display, the developer can know the value of the input variable that is specifically unequal, and the value of the output variable before and after the change at that time.

 図15から図18を用いて、実施例2のソースコード等価性検証装置の処理の具体例について説明する。本実施例では、変更前ソースコードの特定のパスを通ったときと変更後ソースコードの特定のパスを通ったときとの間の等価性(パス等価性と呼ぶ)を、すべてのパスの組合せに対して検証することにより等価性検証を実現する。 A specific example of the processing of the source code equivalence verification apparatus according to the second embodiment will be described with reference to FIGS. In this embodiment, the equivalence (referred to as path equivalence) between when a specific path of the source code before the change and the specific path of the source code after the change is taken is a combination of all paths. Equivalence verification is realized by verifying against.

 変更前ソースコードとして図1に示す変更前ソースコードC100を、C100と非等価な変更である変更後ソースコードとして図12に示す変更後ソースコードC300を入力した場合を例として説明する。 An example will be described in which the pre-change source code C100 shown in FIG. 1 is input as the pre-change source code, and the post-change source code C300 shown in FIG. 12 is input as the post-change source code that is a non-equivalent change to C100.

 本実施例では、ソースコード入力部111、構造グラフ生成部112、および記号実行計算部113の各処理は、実施例1と同一であり、その説明を省略する。 In this embodiment, the processes of the source code input unit 111, the structure graph generation unit 112, and the symbol execution calculation unit 113 are the same as those in the first embodiment, and a description thereof is omitted.

 図15は、本実施例における、等価性検証式生成部114の処理フローチャートである。等価性検証式生成部114は、変更前/後記号実行結果記憶領域203から変更前ソースコードの記号実行サマリを取得する(P141)。等価性検証式生成部114は、未処理の変更前スナップショットが無ければ(P142)、処理を終了する。 FIG. 15 is a processing flowchart of the equivalence verification expression generation unit 114 in this embodiment. The equivalence verification formula generation unit 114 acquires the symbol execution summary of the source code before the change from the pre-change / post-symbol execution result storage area 203 (P141). If there is no unprocessed snapshot before change (P142), the equivalence verification expression generation unit 114 ends the process.

 等価性検証式生成部114は、変更前記号実行前サマリからスナップショットを一つ選択し(P143)、変更前/後記号実行結果記憶領域203から変更後記号実行サマリを取得する(P144)。等価性検証式生成部114は、未処理の変更後スナップショットが無くなければ(P145)、P142に戻る。等価性検証式生成部114は、変更後記号実行サマリのスナップショットを一つ選択し(P146)、パス等価性検証式を生成し(ステップP147)、P145に戻る。等価性検証式生成部114は、未処理の変更前スナップショットが無ければ(P145)、P142に戻るため、変更前スナップショットと変更後スナップショットのすべての組合せに対してパス等価性検証式生成できる。 The equivalence verification expression generation unit 114 selects one snapshot from the pre-change execution summary (P143), and acquires the post-change symbol execution summary from the pre-change / post-code execution result storage area 203 (P144). If there is no unprocessed snapshot after change (P145), the equivalence verification expression generation unit 114 returns to P142. The equivalence verification formula generation unit 114 selects one snapshot of the post-change symbol execution summary (P146), generates a path equivalence verification formula (step P147), and returns to P145. If there is no unprocessed pre-change snapshot (P145), the equivalence verification formula generation unit 114 returns to P142, and therefore generates a path equivalence verification formula for all combinations of the pre-change snapshot and the post-change snapshot. it can.

 等価性検証式生成部114は、選択した変更前スナップショットと変更後スナップショットに対して、スナップショットに対応するパスを通った範囲内での等価性を検証するためのパス等価性検証式を生成し、等価性検証式記憶領域204に格納する(P147)。 The equivalence verification expression generation unit 114 generates a path equivalence verification expression for verifying equivalence in the range that has passed through the path corresponding to the snapshot, for the selected pre-change snapshot and post-change snapshot. It is generated and stored in the equivalence verification formula storage area 204 (P147).

 パス等価性検証式は、対応する出力変数間の等号制約式の連言の否定式と、選択した変更前スナップショットのスナップショット制約式と、選択した変更後スナップショットのスナップショット制約式との連言となる。 The path equivalence verification expression consists of the negation expression of the conjunction of the equality constraint expression between the corresponding output variables, the snapshot constraint expression of the selected before-change snapshot, and the snapshot constraint expression of the selected after-change snapshot. It becomes the conjunction of

 たとえば変更前記号実行サマリS120中のスナップショットS104と変更後記号実行サマリS320中のスナップショットS321を選択したときのパス等価性検証式は、¬((R=R’)∧(g=g’))∧((γ=0)∧(g=γ)∧(R=0))∧((γ=0)∧(g’=γ)∧(R’=0))となる。 For example, when the snapshot S104 in the change execution summary S120 and the snapshot S321 in the post-change symbol execution summary S320 are selected, the path equivalence verification formula is ¬ ((R = R ′) ∧ (g = g ′ )) ∧ ((γ = 0) ∧ (g = γ) ∧ (R = 0)) ∧ ((γ = 0) ∧ (g ′ = γ) ∧ (R ′ = 0)).

 上記の説明例では、等価性検証式生成部114は、一度に一つずつのスナップショットを選択し、パス等価性検証式を生成する。等価性検証式生成部114は、一度に複数のスナップショットを選択しても良い。その場合、パス等価性検証式生成に用いるスナップショット制約式の代わりに、選択したスナップショットに対応するスナップショット制約式の選言を用いる。 In the example described above, the equivalence verification expression generation unit 114 selects one snapshot at a time and generates a path equivalence verification expression. The equivalence verification expression generation unit 114 may select a plurality of snapshots at a time. In that case, the selection of the snapshot constraint formula corresponding to the selected snapshot is used instead of the snapshot constraint formula used to generate the path equivalence verification formula.

 また、上記の説明例では、記号実行計算部113の処理が完了してから、パス等価性検証式を生成する等価性検証式生成部114が処理を開始しているが、記号実行計算部113の実行中において、一部のスナップショットの生成が完了した時点で、当該スナップショットに係る組合せに対するパス等価性検証式の生成のために、等価性検証式生成部114の処理を開始しても良い。 In the example described above, the equivalence verification expression generation unit 114 that generates the path equivalence verification expression starts processing after the processing of the symbol execution calculation part 113 is completed. When the generation of a part of the snapshot is completed during execution of the above, even if the processing of the equivalence verification expression generation unit 114 is started to generate a path equivalence verification expression for the combination related to the snapshot good.

 等価性検証式検証部115は、等価性検証式生成部114によって生成された複数のパス等価性検証式に対して、それぞれSATソルバ等を用いて充足可能性を判定する。等価性検証式検証部115は、それぞれのパス等価性検証式に対して、充足可能か不可能かの結果と、充足可能な場合にはソルバが出力する充足するような変数の値の例である反例とを等価性検証式検証結果記憶領域205に記録する。 The equivalence verification formula verification unit 115 determines satisfiability using a SAT solver or the like for each of the plurality of path equivalence verification formulas generated by the equivalence verification formula generation unit 114. The equivalence verification formula verification unit 115 is an example of the result of whether each path equivalence verification formula is satisfiable or not, and the value of a variable that the solver outputs if it can be satisfied. A counterexample is recorded in the equivalence verification expression verification result storage area 205.

 図16は、本例における各パス等価性検証式の検証結果700である。変更前スナップショットと変更後スナップショットの組合せ9通りのうち、6通りに関しては充足不可能である。また、残りの3通りに関しては充足可能であり、例えば図16の反例の列に示すような反例を得られる。 FIG. 16 shows a verification result 700 of each path equivalence verification formula in this example. Of the nine combinations of the pre-change snapshot and the post-change snapshot, six are unsatisfactory. Further, the remaining three patterns can be satisfied, and for example, a counter example as shown in the counter example column of FIG. 16 can be obtained.

 検証結果生成ステップP160では、検証結果生成部116は、たとえば図17に示すような検証結果レポート600を生成する。 In the verification result generation step P160, the verification result generation unit 116 generates a verification result report 600 as shown in FIG.

 検証結果レポート600には、検証結果表示610として、すべてのパス等価性検証式検証結果が充足不可能な場合には「等価」と、充足可能なパス等価性検証式がある場合には「非等価」と表示される。本例では、例えばスナップショットS113とスナップショットS322を選択したときのパス等価性検証式が充足可能であるため「非等価」と表示される。 In the verification result report 600, the verification result display 610 shows “equivalent” when all path equivalence verification expression verification results are unsatisfiable and “non-existence” when there is a satisfiable path equivalence verification expression. “Equivalent” is displayed. In this example, for example, “not equivalent” is displayed because the path equivalence verification formula when the snapshot S113 and the snapshot S322 are selected can be satisfied.

 検証結果レポート600には、変更前/後記号実行結果記憶領域203に格納されている記号実行サマリ情報を用いて、変更前記号実行サマリ631および変更後記号実行サマリ632の表示を含んでも良い。この時、スナップショットの検証結果639を表示することができる。 The verification result report 600 may include the display of the change issue execution summary 631 and the post-change symbol execution summary 632 using the symbol execution summary information stored in the pre-change / post-change symbol execution result storage area 203. At this time, the snapshot verification result 639 can be displayed.

 スナップショットの検証結果639は、各パス等価性検証式の検証結果700を参照し、当該スナップショットを選択したパス等価性検証式の検証結果すべてが充足不可能であれば「等価」、充足可能なパス等価性検証式があれば「非等価」を表示する。 The verification result 639 of the snapshot refers to the verification result 700 of each path equivalence verification expression. If all the verification results of the path equivalence verification expression that selected the snapshot are unsatisfiable, “equivalent” can be satisfied. If there is a valid path equivalence verification expression, “not equivalent” is displayed.

 本例では、スナップショットS104を選択しているすべてのパス等価性検証式、および、スナップショットS321を選択しているすべてのパス等価性検証式は充足不可能であるため、対応する検証結果が「等価」と表示されている。一方、それ以外のスナップショットにおいては、充足可能なパス等価性検証式を含むため「非等価」と表示されている。 In this example, since all the path equivalence verification expressions that select the snapshot S104 and all the path equivalence verification expressions that select the snapshot S321 cannot be satisfied, the corresponding verification result is “Equivalent” is displayed. On the other hand, other snapshots are displayed as “non-equivalent” because they include a satisfying path equivalence verification formula.

 検証結果レポートは、等価性検証式検証結果記憶領域205に格納されている反例情報を用いて、非等価となるような反例情報640の表示を含んでも良い。この時、記号実行サマリの表示中にスナップショットを選択するためのチェックボックス638を設け、選択したスナップショットの組合せに対するパス等価性検証式の反例を表示するようにしても良い。 The verification result report may include a display of counterexample information 640 that is non-equivalent using counterexample information stored in the equivalence verification formula verification result storage area 205. At this time, a check box 638 for selecting a snapshot may be provided while the symbol execution summary is displayed, and a counter-example of the path equivalence verification formula for the selected combination of snapshots may be displayed.

 図17に示す例では、スナップショットS113とスナップショットS322に対応するチェックボックスを選択した際に、図16にあるスナップショットS113とスナップショットS322から生成されたパス等価性検証式の反例708から得られた情報が表示されている。 In the example illustrated in FIG. 17, when the check boxes corresponding to the snapshot S113 and the snapshot S322 are selected, the path equivalence verification formula generated from the snapshot S113 and the snapshot S322 illustrated in FIG. Displayed information is displayed.

 検証結果レポート600には、さらに、変更前/後ソースコード記憶領域201に格納されているソースコードを用いて、変更前ソースコード621および変更後ソースード622の表示を含んでも良い。このとき、スナップショットを選択するためのチェックボックス638を用いて選択されたスナップショットに対して、当該スナップショットが持つ位置情報から、ソースコード上においてそのスナップショットの経路を表示させても良い。 The verification result report 600 may further include a display of the pre-change source code 621 and the post-change source code 622 using the source code stored in the pre-change / post-source code storage area 201. At this time, for the snapshot selected using the check box 638 for selecting a snapshot, the path of the snapshot may be displayed on the source code from the position information of the snapshot.

 図17に示す例では、変更前ソースコード621上に、スナップショットS113の位置情報を用いてスナップショットS113の経路を下線で表示している。また、変更後ソースコード622上に、スナップショットS322の位置情報を用いてスナップショットS322の経路を下線で表示している。 In the example shown in FIG. 17, the path of the snapshot S113 is displayed as an underline on the source code 621 before the change using the position information of the snapshot S113. Further, the path of the snapshot S322 is displayed as an underline on the changed source code 622 using the position information of the snapshot S322.

 経路を表示する方法としては、図17に示す下線で表示する方法の他にも、背景を別の色で表示する、字体や文字サイズを変えて強調表示する、経路以外の部分の表示を消去して経路のみ表示されるようにする、などの方法がある。 As a method of displaying the route, in addition to the method of displaying with the underline shown in FIG. 17, the background is displayed in a different color, the font is highlighted by changing the font or character size, and the display other than the route is deleted. Then, there is a method such that only the route is displayed.

 あるスナップショットの組合せに対する等価性検証結果が非等価であり、非等価である原因を調査する場合、そのスナップショットの経路上に原因が存在しており、経路以外の箇所は当該スナップショットの結果には影響を与えないため調査不要である。 When investigating the cause of non-equivalence of the equivalence verification results for a combination of snapshots and investigating the cause of non-equivalence, the cause exists on the path of the snapshot, and the location other than the path is the result of the snapshot. There is no need to investigate because there is no impact.

 選択したスナップショットに対応する経路がソースコード上に表示され、また、それらの組合せに対応する反例が表示されることにより、非等価となる入力および出力に対して、開発者がソースコード上で調査すべき範囲を絞り込むことが可能となり、非等価である原因を発見することが容易となる。 The path corresponding to the selected snapshot is displayed on the source code, and the counter example corresponding to the combination of them is displayed. It becomes possible to narrow down the range to be investigated, and it becomes easy to find the cause that is not equivalent.

 図18は検証結果レポート600において、スナップショットを選択するチェックボックス638で複数のスナップショットを選択した際の表示の例を示している。複数のスナップショットを選択した際には、複数のスナップショット経路が存在する。そこで、複数のスナップショット経路に対する表示方法を選択するラジオボタン650を設けて、そこで選択された表示方法に従い経路を表示させることができる。 FIG. 18 shows an example of display when a plurality of snapshots are selected in the check box 638 for selecting a snapshot in the verification result report 600. When a plurality of snapshots are selected, there are a plurality of snapshot paths. Therefore, a radio button 650 for selecting a display method for a plurality of snapshot paths can be provided, and the paths can be displayed according to the display method selected there.

 スナップショット経路表示方法650として、「共通」と「合併」が用意されている。「共通」を選択した場合には、選択された複数のスナップショットすべてが通過する部分のみが経路として表示される。また、「合併」を選択した場合には、選択された複数のスナップショットのうち少なくとも一つが通過する部分が経路として表示される。 As the snapshot path display method 650, “common” and “merger” are prepared. When “common” is selected, only a portion through which all the selected snapshots pass is displayed as a route. When “Merger” is selected, a portion through which at least one of the selected snapshots passes is displayed as a route.

 図18中の変更後ソースコード622に示す例では、非等価なスナップショットであるスナップショットS322とスナップショットS323が選択されており、表示方法としては「共通」が選択されている。そのため、両スナップショットが通過する部分のみが経路として表示される。 In the example shown in the changed source code 622 in FIG. 18, snapshots S322 and S323 which are non-equivalent snapshots are selected, and “common” is selected as the display method. Therefore, only the part where both snapshots pass is displayed as a route.

 一般に、複数のスナップショットに対して等価性検証結果が非等価となった場合、それぞれ個別の原因により非等価となっている可能性より、同一の要因により非等価となっている可能性の方が高い。同一の原因により非等価となっている場合には、複数のスナップショットの経路の共通部分の中にその原因が存在する。そのため、経路の共通部分を表示することにより、開発者がソースコード上で調査すべき範囲を絞り込むことができる。 In general, when equivalence verification results are unequal for multiple snapshots, the possibility of inequality due to the same factor is higher than the possibility of inequality due to individual causes. Is expensive. In the case of non-equivalence due to the same cause, the cause exists in the common part of the paths of a plurality of snapshots. Therefore, by displaying the common part of the path, it is possible to narrow down the range that the developer should investigate on the source code.

 図18の例では、表示された経路のうち、条件評価やreturn文を除くと6行目のg=g+1の処理のみとなる。実際、この行をg=g-1に修正することにより、等価な変更を得ることが可能であり、共通経路を表示することにより、開発者が修正に必要な調査範囲を絞込むことが可能となっている。 In the example of FIG. 18, only the processing of g = g + 1 on the sixth line is performed except for the condition evaluation and the return statement in the displayed route. In fact, it is possible to obtain an equivalent change by correcting this line to g = g-1, and by displaying a common path, the developer can narrow down the investigation range necessary for the correction. It has become.

 複数のスナップショットの経路を表示する方法としては、図18に示す共通部分や合併範囲を表示する方法の他にも、通過するスナップショットの数に対応させて、色の濃度を変化させる、もしくは、文字サイズを変化させる方法などがある。 As a method of displaying a plurality of snapshot paths, in addition to the method of displaying the common part and the merged range shown in FIG. 18, the color density is changed according to the number of snapshots that pass through, or There are methods to change the character size.

 図19を用いて、本実施例のソースコード等価性検証装置の処理の具体例について説明する。 A specific example of processing of the source code equivalence verification apparatus of the present embodiment will be described with reference to FIG.

 等価性検証式生成部114が、実施例1で生成した等価性検証式(本実施例の説明では全体等価性検証式と呼ぶ)と、実施例2で生成したパス等価性検証式とを比較すると、個々のパス等価性検証式の項数は全体等価性検証式の項数よりも小さく、計算量も小さくなるため、そのソルバでの検証時間も短くなる。一方、すべてのパス等価性検証式の合計の計算量は、全体等価性検証式の計算量よりも大きくなる。 The equivalence verification formula generation unit 114 compares the equivalence verification formula generated in the first embodiment (referred to as an overall equivalence verification formula in the description of this embodiment) with the path equivalence verification formula generated in the second embodiment. Then, the number of terms in each path equivalence verification formula is smaller than the number of terms in the overall equivalence verification formula, and the amount of calculation is also small, so the verification time in the solver is also shortened. On the other hand, the total calculation amount of all the path equivalence verification formulas is larger than the calculation amount of the overall equivalence verification formulas.

 本実施例は、これらの特徴を用いて、ソースコード等価性検証装置1000が、全体等価性検証式による検証とパス等価性検証式による検証とを組合せて実行する。 In the present embodiment, using these features, the source code equivalence verification apparatus 1000 executes a combination of verification based on the overall equivalence verification formula and verification based on the path equivalence verification formula.

 本実施例においては、ソースコード等価性検証装置1000は複数のCPU101またはCPUコアを持ち、複数の計算を同時並列で実行可能であるとする。複数のCPUコアで並列計算する代わりに、外部ネットワーク150を通じてクラウドコンピューティング環境またはグリッドコンピューティング環境の外部計算機160を用いることにより並列計算を実現しても良い。 In this embodiment, it is assumed that the source code equivalence verification apparatus 1000 has a plurality of CPUs 101 or CPU cores and can execute a plurality of calculations simultaneously in parallel. Instead of performing parallel calculation with a plurality of CPU cores, parallel calculation may be realized by using an external computer 160 in a cloud computing environment or a grid computing environment through the external network 150.

 図15は、本実施例における、等価性検証式生成部114の処理ステップP140における処理フローチャートである。の詳細を図15に示す。変更前記号実行サマリの取得ステップP141では等価性検証式生成部114は、変更前/後記号実行結果記憶領域203から変更前ソースコードの記号実行サマリを取得する(P141)。 FIG. 15 is a process flowchart in process step P140 of the equivalence verification expression generation unit 114 in the present embodiment. The details are shown in FIG. In acquisition step P141 of the change previous execution summary, the equivalence verification formula generation unit 114 acquires the symbol execution summary of the source code before change from the pre-change / post-symbol execution result storage area 203 (P141).

 本実施例では、ソースコード入力部111、構造グラフ生成部112、および記号実行計算部113の各処理は実施例1と同一であり、その説明を省略する。また、本実施例の等価性検証式生成部114の処理は、実施例1に示す等価性検証式生成部114の処理と実施例2に示す等価性検証式生成部114の処理の両方を実行し、全体等価性検証式とパス等価性検証式との両方を等価性検証式記憶領域204に格納する。 In this embodiment, the processes of the source code input unit 111, the structure graph generation unit 112, and the symbol execution calculation unit 113 are the same as those in the first embodiment, and a description thereof is omitted. Further, the equivalence verification formula generation unit 114 of the present embodiment executes both the equivalence verification formula generation unit 114 shown in the first embodiment and the equivalence verification formula generation unit 114 shown in the second embodiment. Then, both the overall equivalence verification formula and the path equivalence verification formula are stored in the equivalence verification formula storage area 204.

 図19は、本実施例における等価性検証式検証部115の処理フローチャートの一例である。等価性検証式検証部115は全体等価性検証式の検証を開始する(P201)。 FIG. 19 is an example of a processing flowchart of the equivalence verification formula verification unit 115 in the present embodiment. The equivalence verification formula verification unit 115 starts verification of the overall equivalence verification formula (P201).

 等価性検証式検証部115は、パス等価性検証式の内、まだ検証を開始していない式が残っているかどうかを判定し(P202)、残っていればP203に、残っていなければP206に移行する。 The equivalence verification expression verification unit 115 determines whether or not there remains an expression that has not yet been verified among the path equivalence verification expressions (P202). Transition.

 等価性検証式検証部115は、新たにパス等価性検証式の検証を開始するために、空いているCPUコアがあるかどうかを判定し(P203)、あればP204に、なければP206に移行する。 The equivalence verification formula verification unit 115 determines whether there is a free CPU core in order to newly start verification of the path equivalence verification formula (P203). To do.

 等価性検証式検証部115は、まだ検証を開始していないパス等価性検証式の内、一つを選択する(P204)。等価性検証式検証部115は、選択したパス等価性検証式の検証を空いているCPUコア上で開始し(P205)、P206に移行する。 The equivalence verification formula verification unit 115 selects one of the path equivalence verification formulas that have not yet been verified (P204). The equivalence verification formula verification unit 115 starts verification of the selected path equivalence verification formula on an available CPU core (P205), and proceeds to P206.

 等価性検証式検証部115は、以降では、検証を開始した各等価性検証式の検証終了を判定する。等価性検証式検証部115は、全体等価性検証式の検証が終了したかどうかを判定し(P206)、終了した場合にはP207に、終了していない場合にはP208に移行する。 The equivalence verification formula verification unit 115 subsequently determines the end of verification of each equivalence verification formula that has started verification. The equivalence verification formula verification unit 115 determines whether or not the verification of the overall equivalence verification formula has been completed (P206). If the verification is complete, the process proceeds to P207. If not, the process proceeds to P208.

 等価性検証式検証部115は、全体等価性検証式の検証結果が充足不可能かどうかを判定する(P207)。充足不可な場合には、等価性検証の結果が「等価」であるので、パス等価性検証式の検証を継続する必要がなく、等価性検証式検証部115は、処理を終了する。 The equivalence verification formula verification unit 115 determines whether the verification result of the overall equivalence verification formula is unsatisfactory (P207). If it cannot be satisfied, the equivalence verification result is “equivalent”, so there is no need to continue the verification of the path equivalence verification formula, and the equivalence verification formula verification unit 115 ends the processing.

 検証結果が充足可能である場合、等価性検証の結果は「非等価」であるが、全体等価性検証式の検証結果のみでは、スナップショット単位での等価性の情報を得ることができない。そのため、等価性検証式検証部115は、P208に移行し、パス等価性検証式の検証を継続する。 If the verification result is satisfiable, the equivalence verification result is “non-equivalent”, but the equivalence information in snapshot units cannot be obtained only by the verification result of the overall equivalence verification formula. Therefore, the equivalence verification formula verification unit 115 proceeds to P208 and continues to verify the path equivalence verification formula.

 等価性検証式検証部115は、新たに検証が終了したパス等価性検証式があるかどうかを判定し(P208)、ある場合はP209に、ない場合はP211に移行する。 The equivalence verification expression verification unit 115 determines whether there is a path equivalence verification expression that has been newly verified (P208). If there is, the process proceeds to P209, and if not, the process proceeds to P211.

 等価性検証式検証部115は、新たに検証が終了したパス等価性検証式の検証結果が充足可能かどうかを判定し(P209)、充足可能な場合には、P210に移行し、充足不可能な場合にはP211に移行する。 The equivalence verification formula verification unit 115 determines whether the verification result of the path equivalence verification formula that has been newly verified is satisfiable (P209). If the verification result is satisfiable, the process proceeds to P210 and cannot be satisfied. If not, the process proceeds to P211.

 等価性検証式検証部115は、部分検証結果レポートを生成する(P210)。この処理(P210)は、新たに「非等価」であるスナップショットの組合せが発見されたときに実行される。 The equivalence verification formula verification unit 115 generates a partial verification result report (P210). This process (P210) is executed when a new “non-equivalent” snapshot combination is discovered.

 部分検証結果レポートは、終了しているパス等価性検証式検証結果を用いて、実施例2で説明した検証結果生成部116の処理と同様の方法で生成する。この部分検証結果レポートを用いることにより、すべてのパス等価性検証式の検証が終了する前に、開発者は非等価となるスナップショットの組合せ、および、それらのスナップショットの経路を知ることが可能となる。 The partial verification result report is generated by the same method as the processing of the verification result generation unit 116 described in the second embodiment, using the completed path equivalence verification expression verification result. By using this partial verification result report, before the verification of all path equivalence verification expressions is completed, the developer can know the combination of snapshots that are not equivalent and the path of those snapshots. It becomes.

 ステップP211では、等価性検証式検証部115は、すべてのパス等価性検証式の検証が終了したかどうかを判定し(P211)、終了した場合には、処理を終了する。 In step P211, the equivalence verification formula verifying unit 115 determines whether or not the verification of all the path equivalence verification formulas has been completed (P211).

 終了していない検証式(まだ開始していない検証式を含む)が存在する場合には、等価性検証式検証部115は、P202に移行し、新たなパス等価性検証式の検証開始や終了待ちの処理を繰り返す。 If there is a verification formula that has not been completed (including verification formulas that have not yet started), the equivalence verification formula verification unit 115 proceeds to P202 and starts or ends verification of a new path equivalence verification formula. Repeat the waiting process.

 P204における、まだ検証を開始していないパス等価性検証式の内、一つを選択する方法としては、パス等価性検証式の項数が少ない検証式を選択する方法や、式中に使用されている変数の種類数が少ない検証式を選択する方法がある。これらは、検証時間が短くなる可能性の高い検証式を先に実行することにより、短時間で多くの検証式の検証を終了できるという効果がある。 As a method for selecting one of the path equivalence verification formulas that have not yet started verification in P204, a method for selecting a verification formula with a small number of terms in the path equivalence verification formula, or a method used in the formula is used. There is a method of selecting a verification formula with a small number of types of variables. These have the effect that the verification of many verification formulas can be completed in a short time by executing the verification formulas that have a high possibility of shortening the verification time first.

 他の選択方法として、ソースコード上の修正した箇所を経由するスナップショットに係るパス等価性検証式を選択する方法がある。これは、修正した箇所を経由するスナップショットは非等価になる可能性が高く、これを先に検証することにより、より早いタイミングで開発者に非等価であるスナップショットを提示することが可能となる効果がある。 As another selection method, there is a method of selecting a path equivalence verification formula relating to a snapshot passing through a corrected location on the source code. This is because snapshots that go through the modified part are likely to be unequal, and by verifying this first, it is possible to present a snapshot that is unequal to the developer at an earlier timing. There is an effect.

 本実施例における変形例として、全体等価性検証式を用いた検証を省略することができる。具体的には図19に示す処理ステップの内、P201、P206、P207を省略することができる。 As a modification of the present embodiment, verification using the overall equivalence verification formula can be omitted. Specifically, P201, P206, and P207 can be omitted from the processing steps shown in FIG.

 これは、検証結果が非等価となる可能性が高いと予想されるとき、および、CPUコア数が多く、全体等価性検証式の検証が終了する前に、各パス等価性検証式の検証が終了すると見込まれるときに、結果として不要となる全体等価性検証式の検証を省略し、計算量を削減できるという効果がある。 This is because the verification of each path equivalence verification expression is performed when it is predicted that the verification result is likely to be non-equivalent, and before the verification of the entire equivalence verification expression is completed. When it is expected to end, verification of the entire equivalence verification formula that is unnecessary as a result is omitted, and the amount of calculation can be reduced.

 本実施例におけるさらに他の変形例として、部分検証結果生成を省略することができる。具体的には図19に示す処理ステップの内、P208、P209、P210を省略することができる。 As another modification of the present embodiment, partial verification result generation can be omitted. Specifically, P208, P209, and P210 can be omitted from the processing steps shown in FIG.

 これは、開発者に迅速に非等価な部分を提示する必要性が低い場合、および、部分的な検証結果を表示し、修正すべき場所以外の場所を修正することを避けたい場合に、部分検証結果を生成するための計算量を削減できる効果がある。 This is useful if you do not need to quickly show non-equivalent parts to the developer, and if you want to display partial verification results and avoid correcting places other than those that should be corrected. This has the effect of reducing the amount of calculation for generating the verification result.

 なお、本発明は上記した実施例1から3に限定されるものではなく、様々な変形例が含まれる。例えば、上記した実施例は本発明を分かりやすく説明するために詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに限定されない。また、ある実施例の構成の一部を他の実施例に置き換えることが可能であり、また、ある実施例の構成に他の実施例の構成を加えることも可能である。また、各実施例の構成の一部について、他の構成の追加・削除・置換をすることが可能である。また、上記の各構成、機能、処理部、処理手段等は、それらの一部または全部を、例えば集積回路で設計する等によりハードウェアで実現してもよい。 Note that the present invention is not limited to the first to third embodiments described above, and includes various modifications. For example, the above-described embodiments have been described in detail for easy understanding of the present invention, and are not necessarily limited to those having all the configurations described. Further, a part of the configuration of a certain embodiment can be replaced with another embodiment, and the configuration of another embodiment can be added to the configuration of a certain embodiment. Further, it is possible to add, delete, and replace other configurations for a part of the configuration of each embodiment. Each of the above-described configurations, functions, processing units, processing means, and the like may be realized by hardware by designing a part or all of them with, for example, an integrated circuit.

 1000…ソースコード等価性検証装置、101…CPU、102…主記憶装置、103…ネットワークI/F、105…入出力I/F、106…補助記憶装置I/F、110…制御部、120…表示・出力装置、130…入力装置、140…記憶部、150…外部ネットワーク、160…外部計算機、200…ソースコード等価性検証プログラム、201…変更前/後ソースコード記憶領域、202…変更前/後構造グラフ記憶領域、203…変更前/後記号実行結果記憶領域、204…等価性検証式記憶領域、205…等価性検証式検証結果記憶領域、206…検証結果記憶領域、111…ソースコード入力部、112…構造グラフ生成部、113…記号実行計算部、114…等価性検証式生成部、115…等価性検証式検証部、116…検証結果生成部、301…変更前ソースコード、302…変更後ソースコード、310…検証結果レポート、S100、S200、S300…記号実行の実行木、S120、S220、S320…記号実行サマリ、S104、S109、S113、S321~S323…記号実行におけるスナップショット、500、550、600…検証結果レポート。 DESCRIPTION OF SYMBOLS 1000 ... Source code equivalence verification apparatus, 101 ... CPU, 102 ... Main storage device, 103 ... Network I / F, 105 ... Input / output I / F, 106 ... Auxiliary storage device I / F, 110 ... Control part, 120 ... Display / output device 130 ... Input device 140 ... Storage unit 150 ... External network 160 ... External computer 200 ... Source code equivalence verification program 201 ... Before / after source code storage area 202 ... Before change / Post structure graph storage area, 203 ... Pre-change / post symbol execution result storage area, 204 ... Equivalence verification expression storage area, 205 ... Equivalence verification expression verification result storage area, 206 ... Verification result storage area, 111 ... Source code input , 112... Structure graph generation unit, 113... Symbol execution calculation unit, 114... Equivalence verification expression generation unit, 115. ... verification result generation unit, 301 ... source code before change, 302 ... source code after change, 310 ... verification result report, S100, S200, S300 ... execution tree for symbol execution, S120, S220, S320 ... symbol execution summary, S104, S109, S113, S321 to S323 ... Snapshot in symbol execution, 500, 550, 600 ... Verification result report.

Claims (12)

 変更前ソースコードと前記変更前ソースコードを変更した変更後ソースコードとを対象に、それぞれ記号実行計算する記号実行計算部(113)、
 前記記号実行計算部の記号実行計算結果である記号実行サマリに基づいて、前記変更前ソースコードと前記変更後ソースコードとの、同じ入力に対して同じ出力が得られることである等価性を検証するための等価性検証式を生成する等価性検証式生成部、
 前記等価性検証式生成部で生成された前記等価性検証式を検証する等価性検証式検証部、および
 前記等価性検証式検証部における検証結果を用いて検証結果レポートを生成する検証結果生成部を有することを特徴とするソースコード等価性検証装置。
Symbol execution calculation unit (113) for performing symbol execution calculation on the source code before change and the source code after change obtained by changing the source code before change,
Based on the symbol execution summary, which is the symbol execution calculation result of the symbol execution calculation unit, the equivalence that the same output is obtained for the same input of the source code before change and the source code after change is verified. An equivalence verification expression generation unit for generating an equivalence verification expression for
An equivalence verification formula verification unit that verifies the equivalence verification formula generated by the equivalence verification formula generation unit, and a verification result generation unit that generates a verification result report using the verification result in the equivalence verification formula verification unit A source code equivalence verification apparatus comprising:
 請求項1に記載のソースコード等価性検証装置において、前記等価性検証式生成部は、前記変更前ソースコードおよび前記変更後ソースコードの前記記号実行サマリを構成する各スナップショットの組合せに対する、前記変更前ソースコードと前記変更後ソースコードとで対応する出力変数間の等号制約式、前記変更前ソースコードの前記スナップショットのスナップショット制約式、および前記変更後ソースコードの前記スナップショットの前記スナップショット制約式を含むパス等価性検証式を生成することを特徴とするソースコード等価性検証装置。 The source code equivalence verification apparatus according to claim 1, wherein the equivalence verification expression generation unit is configured to perform a combination of snapshots constituting the symbol execution summary of the pre-change source code and the post-change source code. An equality constraint between output variables corresponding to the source code before the change and the source code after the change, the snapshot constraint formula of the snapshot of the source code before the change, and the snapshot of the snapshot of the source code after the change A source code equivalence verification apparatus that generates a path equivalence verification expression including a snapshot constraint expression.  請求項2に記載のソースコード等価性検証装置において、前記検証結果生成部は、前記スナップショットの組合せに対して、前記変更前ソースコードおよび前記変更後ソースコードの前記スナップショットに対応するパスの経路、および、前記等価性検証式検証部による前記パスの組合せに対する検証結果が非等価であるときはその反例を表示する前記検証結果レポートを生成することを特徴とするソースコード等価性検証装置。 The source code equivalence verification apparatus according to claim 2, wherein the verification result generation unit includes a path corresponding to the snapshot of the pre-change source code and the post-change source code for the snapshot combination. A source code equivalence verification apparatus that generates a verification result report that displays a counterexample when a verification result of a path and the path combination by the equivalence verification expression verification unit is not equivalent.  請求項3に記載のソースコード等価性検証装置において、検証結果生成部は、複数の前記スナップショットが選択された場合に、それぞれの前記スナップショットに対応する前記パスの経路の共通部分および合併部分の一方を表示する前記検証結果レポートを生成することを特徴とするソースコード等価性検証装置。 4. The source code equivalence verification apparatus according to claim 3, wherein when a plurality of the snapshots are selected, the verification result generation unit includes a common part and a merged part of the path paths corresponding to the snapshots. A verification result report for displaying one of the above, a source code equivalence verification device.  請求項2に記載のソースコード等価性検証装置において、前記等価性検証式検証部は、前記変更前ソースコードの特定のパスを通ったときと前記変更後ソースコードの特定のパスを通ったときとの間の等価性を検証するパス等価性検証式、および、前記等価性検証式を並列に検証することを特徴とするソースコード等価性検証装置。 The source code equivalence verification apparatus according to claim 2, wherein the equivalence verification expression verification unit passes through a specific path of the source code before change and a specific path of the source code after change. A path equivalence verification expression for verifying equivalence between and a source code equivalence verification apparatus for verifying the equivalence verification expression in parallel.  請求項5に記載のソースコード等価性検証装置において、前記等価性検証式検証部が並列に検証した、前記等価性検証式および前記パス等価性検証式の検証式の検証の終了に応じて、前記検証結果レポートを生成することを特徴とするソースコード等価性検証装置。 In the source code equivalence verification apparatus according to claim 5, according to the end of verification of the equivalence verification expression and the verification expression of the path equivalence verification expression verified in parallel by the equivalence verification expression verification unit, A source code equivalence verification apparatus that generates the verification result report.  ソースコード等価性検証装置におけるソースコード等価性検証方法であって、前記ソースコード等価性検証装置は、
 変更前ソースコードと前記変更前ソースコードを変更した変更後ソースコードとを対象に記号実行計算し、
 前記記号実行計算結果である記号実行サマリに基づいて、前記変更前ソースコードと前記変更後ソースコードとの、同じ入力に対して同じ出力が得られることである等価性を検証するための等価性検証式を生成し、
 生成された前記等価性検証式を検証し、
 前記検証結果を用いて検証結果レポートを生成することを特徴とするソースコード等価性検証方法。
A source code equivalence verification method in a source code equivalence verification apparatus, wherein the source code equivalence verification apparatus includes:
Symbol execution calculation is performed on the source code before change and the source code after change after changing the source code before change,
Equivalence for verifying equivalence that the same output is obtained for the same input of the source code before change and the source code after change based on the symbol execution summary that is the result of the symbol execution calculation Generate a validation expression
Validate the generated equivalence verification formula,
A source code equivalence verification method, wherein a verification result report is generated using the verification result.
 請求項7に記載のソースコード等価性検証方法において、前記ソースコード等価性検証装置は、は、前記変更前ソースコードおよび前記変更後ソースコードの前記記号実行サマリを構成する各スナップショットの組合せに対する、前記変更前ソースコードと前記変更後ソースコードとで対応する出力変数間の等号制約式、前記変更前ソースコードの前記スナップショットのスナップショット制約式、および前記変更後ソースコードの前記スナップショットの前記スナップショット制約式を含むパス等価性検証式を生成することを特徴とするソースコード等価性検証方法。 8. The source code equivalence verification method according to claim 7, wherein the source code equivalence verification apparatus is configured for each combination of snapshots constituting the symbol execution summary of the pre-change source code and the post-change source code. , An equality constraint expression between output variables corresponding to the source code before change and the source code after change, a snapshot constraint expression of the snapshot of the source code before change, and the snapshot of the source code after change A source code equivalence verification method, comprising: generating a path equivalence verification formula including the snapshot constraint formula.  請求項8に記載のソースコード等価性検証方法において、前記ソースコード等価性検証装置は、前記スナップショットの組合せに対して、前記変更前ソースコードおよび前記変更後ソースコードの前記スナップショットに対応するパスの経路、および、前記パスの組合せに対する検証結果が非等価であるときはその反例を表示する前記検証結果レポートを生成することを特徴とするソースコード等価性検証方法。 9. The source code equivalence verification method according to claim 8, wherein the source code equivalence verification apparatus corresponds to the snapshot of the pre-change source code and the post-change source code for the combination of snapshots. A source code equivalence verification method, comprising: generating a verification result report that displays a counterexample when a verification result for a path and a combination of paths is not equivalent.  請求項9に記載のソースコード等価性検証方法において、前記ソースコード等価性検証装置は、複数の前記スナップショットが選択された場合に、それぞれの前記スナップショットに対応する前記パスの経路の共通部分および合併部分の一方を表示する前記検証結果レポートを生成することを特徴とするソースコード等価性検証方法。 The source code equivalence verification method according to claim 9, wherein when the plurality of snapshots are selected, the source code equivalence verification device is configured to share a common part of the path of the path corresponding to each snapshot. And generating the verification result report displaying one of the merged portions.  請求項8に記載のソースコード等価性検証方法において、前記ソースコード等価性検証装置は、前記変更前ソースコードの特定のパスを通ったときと前記変更後ソースコードの特定のパスを通ったときとの間の等価性を検証するパス等価性検証式、および、前記等価性検証式を並列に検証することを特徴とするソースコード等価性検証方法。 9. The source code equivalence verification method according to claim 8, wherein the source code equivalence verification device passes through a specific path of the pre-change source code and a specific path of the post-change source code. A path equivalence verification formula for verifying equivalence between and a source code equivalence verification method, wherein the equivalence verification formula is verified in parallel.  請求項11に記載のソースコード等価性検証方法において、前記ソースコード等価性検証装置は、並列に検証した、前記等価性検証式および前記パス等価性検証式の検証式の検証の終了に応じて、前記検証結果レポートを生成することを特徴とするソースコード等価性検証方法。 The source code equivalence verification method according to claim 11, wherein the source code equivalence verification apparatus is configured to verify in parallel the verification of the equivalence verification expression and the verification expression of the path equivalence verification expression in parallel. A method for verifying source code equivalence, wherein the verification result report is generated.
PCT/JP2014/074282 2014-09-12 2014-09-12 Source code equivalence verifying device, and source code equivalence verifying method Ceased WO2016038741A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/JP2014/074282 WO2016038741A1 (en) 2014-09-12 2014-09-12 Source code equivalence verifying device, and source code equivalence verifying method
JP2016547643A JP6279750B2 (en) 2014-09-12 2014-09-12 Source code equivalence verification device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2014/074282 WO2016038741A1 (en) 2014-09-12 2014-09-12 Source code equivalence verifying device, and source code equivalence verifying method

Publications (1)

Publication Number Publication Date
WO2016038741A1 true WO2016038741A1 (en) 2016-03-17

Family

ID=55458526

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2014/074282 Ceased WO2016038741A1 (en) 2014-09-12 2014-09-12 Source code equivalence verifying device, and source code equivalence verifying method

Country Status (2)

Country Link
JP (1) JP6279750B2 (en)
WO (1) WO2016038741A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110520850A (en) * 2017-04-19 2019-11-29 三菱电机株式会社 Equivalence verifies device and equivalence proving program
JP2023143729A (en) * 2022-03-25 2023-10-06 ウーブン・バイ・トヨタ株式会社 Correctness verification system, method, device, and program
WO2024236820A1 (en) * 2023-05-18 2024-11-21 日本電信電話株式会社 Security assurance system, security assurance method, and program

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014126985A (en) * 2012-12-26 2014-07-07 Hitachi Ltd Source code equivalence verification device, and source code equivalence verification method
JP2014186477A (en) * 2013-03-22 2014-10-02 International Business Maschines Corporation Information processing device, information processing method, and program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014126985A (en) * 2012-12-26 2014-07-07 Hitachi Ltd Source code equivalence verification device, and source code equivalence verification method
JP2014186477A (en) * 2013-03-22 2014-10-02 International Business Maschines Corporation Information processing device, information processing method, and program

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MASATOSHI YOSHIDA: "Shiyo Kijutsu o Hitsuyo to shinai Yukai Regression Kenchi Framework no Teian", LECTURE NOTE/SOFTWARE-GAKU 36 SOFTWARE KOGAKU NO KISO XVII, 30 November 2010 (2010-11-30), pages 181 - 182 *
TAKESHI MATSUMOTO ET AL.: "C Base Koi Sekkei ni Okeru Tokasei Kensho Framework to Hanrei Kaiseki Shuho no Teian", THE 18TH WORKSHOP ON CIRCUITS AND SYSTEMS KARUIZAWA RONBUNSHU, THE INSTITUTE OF ELECTRONICS, INFORMATION AND COMMUNICATION ENGINEERS, 26 April 2005 (2005-04-26), pages 557 - 562 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110520850A (en) * 2017-04-19 2019-11-29 三菱电机株式会社 Equivalence verifies device and equivalence proving program
CN110520850B (en) * 2017-04-19 2023-08-11 三菱电机株式会社 Equivalence verification device and computer-readable storage medium
JP2023143729A (en) * 2022-03-25 2023-10-06 ウーブン・バイ・トヨタ株式会社 Correctness verification system, method, device, and program
JP7499366B2 (en) 2022-03-25 2024-06-13 ウーブン・バイ・トヨタ株式会社 Accuracy verification system, method, device, and program
WO2024236820A1 (en) * 2023-05-18 2024-11-21 日本電信電話株式会社 Security assurance system, security assurance method, and program

Also Published As

Publication number Publication date
JPWO2016038741A1 (en) 2017-04-27
JP6279750B2 (en) 2018-02-14

Similar Documents

Publication Publication Date Title
JP6419953B2 (en) Source code equivalence verification apparatus and source code equivalence verification method
US8856726B2 (en) Verification of computer-executable code generated from a slice of a model
JP5775829B2 (en) Software structure visualization program and system
US11314225B2 (en) Systems and methods for evaluating assessments
US20170235661A1 (en) Integration of Software Systems via Incremental Verification
US9665674B2 (en) Automating a microarchitecture design exploration environment
JP2012059026A (en) Source code conversion method and source code conversion program
US10445225B2 (en) Command coverage analyzer
US20160132417A1 (en) Verifying a graph-based coherency verification tool
US20200183658A1 (en) Identification and visualization of associations among code generated from a model and sources that affect code generation
JP5450840B2 (en) Test data generation method for program execution performance evaluation
Liakh et al. Formal model of IEC 61499 execution trace in FBME IDE
JP6279750B2 (en) Source code equivalence verification device
EP2718821B1 (en) Verification of computer-executable code generated from a model
Yoo et al. Verification of PLC programs written in FBD with VIS
Alsaedi et al. Leveraging Large Language Models for Automated Bug Fixing.
CN110399156B (en) On-orbit upgrading method for aerospace software
Auguston et al. Behavior models and composition for software and systems architecture
Manolios et al. A model-based framework for analyzing the safety of system architectures
WO2016151703A1 (en) Source code equivalence verification device and source code equivalence verification method
JP2016126700A (en) Program verification device, program verification method, and program verification program
US20250035697A1 (en) Bias cause reduction for localizing constraints
Jana et al. Automated planning for finding alternative bug traces
JP5643971B2 (en) Source code conversion method and source code conversion program
Chaari et al. Efficient exploration of safety-relevant systems through a link between analysis and simulation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14901484

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2016547643

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14901484

Country of ref document: EP

Kind code of ref document: A1