CN113703776B - Interval analysis method and device for indirect boundary - Google Patents
Interval analysis method and device for indirect boundary Download PDFInfo
- Publication number
- CN113703776B CN113703776B CN202111031113.4A CN202111031113A CN113703776B CN 113703776 B CN113703776 B CN 113703776B CN 202111031113 A CN202111031113 A CN 202111031113A CN 113703776 B CN113703776 B CN 113703776B
- Authority
- CN
- China
- Prior art keywords
- value
- interval
- indirect
- maximum
- boundary value
- 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.)
- Active
Links
- 238000004458 analytical method Methods 0.000 title claims abstract description 59
- 230000014509 gene expression Effects 0.000 claims abstract description 117
- 238000000034 method Methods 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 12
- 238000012360 testing method Methods 0.000 claims description 8
- 239000011159 matrix material Substances 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 12
- 230000006870 function Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000010276 construction Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 241000579895 Chlorostilbon Species 0.000 description 1
- 239000010976 emerald Substances 0.000 description 1
- 229910052876 emerald Inorganic materials 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 150000004820 halides Chemical class 0.000 description 1
- 239000010977 jade Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- ZLIBICFPKPWGIZ-UHFFFAOYSA-N pyrimethanil Chemical compound CC1=CC(C)=NC(NC=2C=CC=CC=2)=N1 ZLIBICFPKPWGIZ-UHFFFAOYSA-N 0.000 description 1
- 239000010979 ruby Substances 0.000 description 1
- 229910001750 ruby Inorganic materials 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/37—Compiler construction; Parser generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the specification provides a section analysis method and a section analysis device for indirect boundaries. In the interval analysis method, a first indirect value index object serving as a first target boundary value in an operation interval of an interval object to be solved is determined, an integer value corresponding to the first indirect value index object is stored in a memory, the first indirect value index object is defined as an integer type, and the interval object to be solved has a fixed attribute interval; determining a first maximum expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and the first boundary value to be adjusted in the attribute interval, wherein the first boundary value to be adjusted and the first target boundary value belong to the same maximum type in the affiliated interval, and the first maximum expression is used for determining the boundary value belonging to the same maximum type in the operation interval; and obtaining an operation interval comprising the first maximum expression according to the first maximum expression.
Description
Technical Field
The embodiment of the specification relates to the technical field of computers, in particular to a section analysis method and a section analysis device for indirect boundaries.
Background
In case testing in the computer field, boundary conditions are determined first, which may be determined by interval analysis (INTERVAL ANALYSIS), which may be performed by a compiler.
Before the use case runs, the compiler performs boundary analysis on the use case to determine the boundary of the use case. For example, the use case to be run is the sum calculation of an array a, the size of which is 100, i.e. the array a includes 100 values to be summed. During the compilation stage, the compiler performs boundary analysis on the array a, and can determine that the boundary of the array a is (0, 99), that is, the index value of the array a is from 0 to 99. In the operation stage, the summation calculation is sequentially performed on each numerical value corresponding to the index value from 0 to 99 in the group A.
Disclosure of Invention
In view of the above, the present embodiments provide a section analysis method and a section analysis apparatus for indirect boundaries. By the technical scheme of the embodiment of the specification, the section analysis can be correctly executed under the condition that the boundary value is an indirect value.
According to an aspect of the embodiments of the present specification, there is provided an interval analysis method for indirect boundaries, including: determining a first indirect value index object serving as a first target boundary value in an operation interval of an interval object to be solved, wherein an integer value corresponding to the first indirect value index object is stored in a memory, the first indirect value index object is defined as an integer type, and the interval object to be solved has a fixed attribute interval; determining a first maximum expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and the first boundary value to be adjusted in the attribute interval, wherein the first boundary value to be adjusted and the first target boundary value belong to the same maximum type in the interval, and the first maximum expression is used for determining boundary values belonging to the same maximum type in the operation interval; and obtaining the operation interval comprising the first maximum expression according to the first maximum expression.
According to another aspect of the embodiments of the present specification, there is also provided an interval analysis apparatus for indirect boundaries, including: an indirect value index object determining unit configured to determine a first indirect value index object serving as a first target boundary value in an operation interval of an interval object to be solved, wherein an integer value corresponding to the first indirect value index object is stored in a memory, the first indirect value index object is defined as an integer type, and the interval object to be solved has a fixed attribute interval; a maximum value expression determining unit configured to determine a first maximum value expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and a first boundary value to be adjusted in the attribute interval, where the first boundary value to be adjusted and the first target boundary value belong to the same maximum value type in the interval, and the first maximum value expression is used to determine a boundary value belonging to the same maximum value type in the operation interval; and an operation section determining unit configured to obtain the operation section including the first maximum expression from the first maximum expression.
According to another aspect of the embodiments of the present specification, there is also provided an electronic device including: at least one processor, a memory coupled with the at least one processor, and a computer program stored on the memory, the at least one processor executing the computer program to implement any of the interval analysis methods for indirect boundaries described above.
According to another aspect of the embodiments of the present specification, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the section analysis method for indirect boundaries as described above.
According to another aspect of embodiments of the present specification, there is also provided a computer program product comprising a computer program which, when executed by a processor, implements a section analysis method for indirect boundaries as described in any of the above.
Drawings
A further understanding of the nature and advantages of the embodiments herein may be realized by reference to the following drawings. In the drawings, similar components or features may have the same reference numerals.
Fig. 1 shows a flowchart of one example of an interval analysis method for indirect boundaries of the embodiment of the present specification.
Fig. 2A shows a schematic diagram of one example of determining an operation section of the embodiment of the present specification.
Fig. 2B shows a schematic diagram of another example of determining an operation section of the embodiment of the present specification.
Fig. 2C shows a schematic diagram of another example of determining an operation section of the embodiment of the present specification.
Fig. 3 shows a block diagram of one example of an interval analysis apparatus for indirect boundaries according to an embodiment of the present specification.
Fig. 4 shows a block diagram of an electronic device for implementing the interval analysis method of the indirect boundary according to the embodiment of the present specification.
Detailed Description
The subject matter described herein will be discussed below with reference to example embodiments. It should be appreciated that these embodiments are discussed only to enable a person skilled in the art to better understand and thereby practice the subject matter described herein, and are not limiting of the scope, applicability, or examples set forth in the claims. Changes may be made in the function and arrangement of elements discussed without departing from the scope of the embodiments herein. Various examples may omit, replace, or add various procedures or components as desired. In addition, features described with respect to some examples may be combined in other examples as well.
As used herein, the term "comprising" and variations thereof mean open-ended terms, meaning "including, but not limited to. The term "based on" means "based at least in part on". The terms "one embodiment" and "an embodiment" mean "at least one embodiment. The term "another embodiment" means "at least one other embodiment". The terms "first," "second," and the like, may refer to different or the same object. Other definitions, whether explicit or implicit, may be included below. Unless the context clearly indicates otherwise, the definition of a term is consistent throughout this specification.
In case testing in the computer field, boundary conditions are first determined, which may be determined by interval analysis (INTERVAL ANALYSIS). The interval analysis techniques may be performed by a compiler.
Before the use case runs, the compiler performs boundary analysis on the use case to determine the boundary of the use case. For example, the use case to be run is the sum calculation of an array a, the size of which is 100, i.e. the array a includes 100 values to be summed. During the compilation stage, the compiler performs boundary analysis on the array a, and can determine that the boundary of the array a is (0, 99), that is, the index value of the array a is from 0 to 99. In the operation stage, the summation calculation is sequentially performed on each numerical value corresponding to the index value from 0 to 99 in the group A.
However, the compiler currently has a certain limitation in performing the boundary analysis, and requires that the boundary value of the analyzed section must be an integer, otherwise the boundary value cannot be processed correctly. For example, when the boundary value of the set section is an indirect value represented by an array, since the value corresponding to the array is stored in the memory, the compiler cannot know the value, and thus the section obtained when the section analysis is performed on the array is (-definition, +definition), that is, a section from minus infinity to plus infinity. And the interval is an erroneous interval, resulting in a boundary analysis error of the compiler.
In view of the foregoing, the embodiments of the present disclosure provide a method and an apparatus for analyzing an interval of an indirect boundary. In the method, a first indirect value index object serving as a first target boundary value in an operation interval of an interval object to be solved is determined, an integer value corresponding to the first indirect value index object is stored in a memory, the first indirect value index object is defined as an integer type, and the interval object to be solved has a fixed attribute interval; determining a first maximum expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and the first boundary value to be adjusted in the attribute interval, wherein the first boundary value to be adjusted and the first target boundary value belong to the same maximum type in the affiliated interval, and the first maximum expression is used for determining the boundary value belonging to the same maximum type in the operation interval; and obtaining an operation interval comprising the first maximum expression according to the first maximum expression. By the technical scheme of the embodiment of the specification, the section analysis can be correctly executed under the condition that the boundary value is an indirect value.
The section analysis method and section analysis device for indirect boundaries provided in the embodiments of the present specification are described in detail below with reference to the accompanying drawings.
Fig. 1 shows a flowchart of one example 100 of an interval analysis method for indirect boundaries of embodiments of the present specification.
The interval analysis method illustrated in fig. 1 may be performed by a compiler, which may include TVM HALIDE compiler, or the like. The compiler can be triggered to execute the interval analysis operation of the interval object to be solved, and output the operation interval which is obtained through interval analysis and aims at the interval object to be solved.
The running interval including the first highest expression obtained by the compiler through interval analysis can be used for the subsequent running process aiming at the interval object to be solved. In the running process, the processor may obtain the integer value corresponding to the indirection value index object (for example, the first indirection value index object and the second indirection value index object) from the memory, so as to determine a specific numerical value corresponding to the most significant expression (for example, the first most significant expression and the second most significant expression) in the running interval, and further determine the specific running interval based on the specific numerical value. The processor performs the corresponding operations in this particular run interval.
As shown in fig. 1, at 110, a first indirect value index object is determined as a first target boundary value in a running interval of the interval object to be solved.
In the embodiment of the present specification, the object to be solved may be an object to be executed, which has an execution section for limiting an execution range in execution during execution. For example, the interval object to be solved may be an array in a test case, where the test case is to perform traversal summation on the array, and in the operation process of performing traversal summation, the operation interval defined by the array determines the number of array elements of the array summation. For example, if the running interval defined by the array is (0, 100), the object of the traversal summation is each numerical value corresponding to the index value from 0 to 100 in the array.
The operation interval of the interval object to be solved is an interval used by the interval object to be solved in operation, and the operation interval can limit the range of the interval object to be solved in operation. The run interval may be determined by interval analysis in a compilation process prior to run.
Furthermore, the object to be solved may also have an attribute section, which may be an attribute information belonging to the object to be solved itself, the attribute section of the object to be solved being determined and fixed. For example, the object of the interval to be solved is an array, and the array includes 101 ordered elements, and then the attribute interval of the array is (0, 100), that is, 101 array elements corresponding to the index value 0 to the index value 100.
In the embodiment of the present specification, the first indirect value index object is an indirect index object corresponding to a numerical value, and the indirect index object may include any one of an array, a vector, a matrix, and a tensor. The value corresponding to the first indirection value index object may be an integer value, and the integer value corresponding to the first indirection value index object may be stored in the memory. The first indirection value index object may be used to characterize the corresponding integer value, based on which when the first indirection value index object is used, it may be considered that the integer value corresponding to the first indirection value index object is used.
For example, the first indirect value index object is an index element B (0) in the array B, and the integer value corresponding to B (0) is 10, and the integer value 10 is stored in the memory. The first indirection value index object may characterize the integer value 10, and the integer value 10 may be retrieved from memory during operation through the first indirection value index object.
In the present specification embodiment, the determined first indirection value index object may be defined as an integer type. In one manner of definition, a first indirection value index object may be defined as an integer type in code, and then a defined statement is input to a compiler that performs interval analysis, so that the compiler may take the first indirection value index object as a value of the integer type.
In the embodiment of the present specification, the first indirect value index object may be determined as the first target boundary value in the running section of the section object to be solved. The boundary values in the operation interval include a maximum boundary value and a minimum boundary value, and the determined first target boundary value may be the maximum boundary value or the minimum boundary value in the operation interval. For example, when the first target boundary value is the maximum boundary value in the running interval, then the first indirect value index object is the maximum boundary value in the running interval; when the first target boundary value is the minimum boundary value in the running interval, then the first indirect value index object is the minimum boundary value in the running interval.
At 120, a first maximum expression between the first indirection value index object and the first boundary value to be adjusted is determined according to the first indirection value index object and the first boundary value to be adjusted in the attribute interval.
In this embodiment of the present disclosure, the first boundary value to be adjusted is one of the boundary values in the attribute interval, and the first boundary value to be adjusted and the first target boundary value belong to the same maximum type in the interval to which the first target boundary value belongs.
The maximum value type may include a maximum value type and a minimum value type. When the maximum value type is the maximum value type, the first target boundary value is the maximum boundary value in the running interval, and correspondingly, the first boundary value to be adjusted is the maximum boundary value in the attribute interval. When the most value type is the minimum value type, the first target boundary value is the minimum boundary value in the running interval, and correspondingly, the first boundary value to be adjusted is the minimum boundary value in the attribute interval.
The determined first maximum expression is used for comparing the maximum value between the first indirect value index object and the first boundary value to be adjusted, and the obtained maximum value belongs to the maximum value of the same maximum value type of the first indirect value index object and the first boundary value to be adjusted.
For example, if the same maximum value type to which both the first indirect value index object and the first boundary value to be adjusted belong is the maximum value type, the first maximum value expression is used to determine the maximum value of both the first indirect value index object and the first boundary value to be adjusted, and at this time, the first maximum value expression may be expressed as min (a max, B (0)), where a max is the first boundary value to be adjusted as the maximum boundary value in the attribute section, B (0) is the first indirect value index object as the first target boundary value in the operation section, and min (a max, B (0)) represents the smallest one selected from a max and B (0) as the maximum boundary value in the operation section.
For another example, if the same type of maximum value to which both the first indirect value index object and the first boundary value to be adjusted belong is the minimum value type, the first maximum value expression is used to determine the minimum value of both the first indirect value index object and the first boundary value to be adjusted, and at this time, the first maximum value expression may be represented as max (a min, B (0)), where a min is the first boundary value to be adjusted that is the minimum boundary value in the attribute section, and max (a min, B (0)) represents that the largest one is selected from a min and B (0) as the minimum boundary value in the operation section.
In the embodiment of the present disclosure, the first maximum expression is used to determine the boundary values belonging to the same maximum type in the operation interval, and then the value obtained by the first maximum expression is used as the boundary value belonging to the same maximum type in the operation interval. For example, the first maximum expression in the above example is min (a max, B (0)), and the resulting value is taken as the maximum boundary value in the running interval. For another example, the first highest expression in the above example is max (a min, B (0)), and the resulting value is taken as the minimum boundary value in the running section.
In one example, after the first indirect value index object serving as the first target boundary value of the operation interval is determined, the first indirect value index object and the first boundary value to be adjusted may be directly determined as the maximum value comparison object, and the first indirect value index object serving as the maximum value comparison object and the first boundary value to be adjusted may be directly compared, where one way of direct comparison is to form a first maximum value expression between the first indirect value index object and the first boundary value to be adjusted, so as to determine, from the first indirect value index object and the first boundary value to be adjusted, the maximum value of the same maximum value type to which the first indirect value index object and the first boundary value to be adjusted belong, and the maximum value may be the boundary value of the same maximum value type to which the first indirect value index object and the first boundary value to be adjusted belong in the operation interval.
For example, the first indirect value index object B (0) and the first boundary value to be adjusted a max are determined as the maximum value comparison object, and the first maximum value expression between the first indirect value index object and the first boundary value to be adjusted is formed as min (a max, B (0)).
In another example, a first interval of a first indirection value index object may be determined from the first indirection value index object, the first interval being an interval for the first indirection value index object. Therefore, the maximum boundary value and the minimum boundary value in the first section are both the first indirect value index object. For example, if the first indirection value index object is B (0), the first section of the first indirection value index object is (B (0), B (0)), and the maximum boundary value and the minimum boundary value in the first section are both B (0).
Then, a first maximum expression composed of the first indirect value index object and the first boundary value to be adjusted may be determined according to the first section and the attribute section.
Specifically, when the first indirect value index object and the first boundary value to be adjusted belong to the maximum value in the belonging section, the maximum value of the first indirect value index object in the first section may be determined, that is, may be represented as max (B (0)), and then max (B (0)) may be compared with the first boundary value to be adjusted, which is the maximum boundary value in the attribute section, may be represented as min (a max, max (B (0)), based on which the first section of the first indirect value index object is (B (0), B (0)), so that the first maximum value expression at this time may be derived as min (a max, B (0)), which may be used to determine the maximum value in the operation section, wherein a max is the first boundary value to be adjusted, which is the first boundary value to be adjusted, and B (0) is the first indirect value index object, which is the first target boundary value in the operation section.
When the first indirect value index object and the first boundary value to be adjusted belong to the minimum value in the belonging section, the minimum value of the first indirect value index object in the first section may be determined, that is, may be expressed as min (B (0)), and then, min (B (0)) may be compared with the first boundary value to be adjusted, which is the minimum boundary value in the attribute section, may be expressed as max (a min, min (B (0)), based on which the first section is (B (0), B (0)), so that the first maximum value expression at this time may be derived as max (a min, B (0)), which may be used to determine the minimum value in the operation section, wherein a min is the first boundary value to be adjusted, which is the minimum boundary value in the attribute section, and B (0) is the first indirect value index object, which is the first target boundary value in the operation section.
After the first maximum expression is obtained, a boundary value belonging to the same maximum type as the first boundary value to be adjusted and the first target boundary value in the running interval can be determined. Then, at 130, an operating interval including the first maximum expression may be derived from the first maximum expression.
When the first maximum expression determines that it is a boundary value of the maximum value type, the maximum value in the operation section is represented by the first maximum expression. When the first maximum expression determines a boundary value of the minimum type, the minimum value in the operation section is represented by the first maximum expression.
In one example, when another boundary value other than the first boundary value to be adjusted in the attribute section is not adjusted, the operation section may be constituted by the first maximum value expression and the other boundary value. Wherein the further boundary value is an integer value.
When the first maximum expression is used to determine the boundary value of the maximum value type, the other boundary value is the minimum boundary value in the running interval. At this time, the operation section formed may be expressed as (a min,min(Amax, B (0)). Where a min represents another boundary value, min (a max, B (0)) represents the first maximum expression.
Fig. 2A shows a schematic diagram of one example of determining an operation section of the embodiment of the present specification. As shown in FIG. 2A, the minimum boundary value in array A is index value A min. The first determined expression is min (A max, B (0)), then the resulting run interval is shown as (A min,min(Amax, B (0)).
When the first maximum expression is used to determine the boundary value of the minimum type, the other boundary value is the maximum boundary value in the running interval. At this time, the constructed operation section may be expressed as (max (a min,B(0)),Amax) ·, where a max represents another boundary value, and max (a min, B (0)) represents the first maximum expression.
Fig. 2B shows a schematic diagram of another example of determining an operation section of the embodiment of the present specification. As shown in FIG. 2B, the maximum boundary value in array A is index value A max. The first determined expression is max (a min, B (0)), then the resulting run interval is shown as (max (a min,B(0)),Amax).
In one example, when both boundary values in the attribute interval need to be adjusted, the first boundary value to be adjusted is one of the boundary values in the attribute interval and the second boundary value to be adjusted is the other boundary value in the attribute interval. For the first boundary value to be adjusted, the corresponding first maximum expression may be obtained in the above manner.
For the second boundary value to be adjusted, a second most significant expression between the second indirect value index object and the second boundary value to be adjusted may be formed according to the second indirect value index object and the second boundary value to be adjusted in the attribute interval. Wherein the second indirection value index object may be a second target boundary value in the run interval. The second target boundary value is a boundary value opposite to the first target boundary value, for example, when the first target boundary value is a maximum boundary value, then the second target boundary value is a minimum boundary value; when the first target boundary value is the minimum boundary value, then the second target boundary value is the maximum boundary value.
In this example, the integer value corresponding to the second indirection value index object is stored in memory, the second indirection value index object being defined as an integer value. The second boundary value to be adjusted and the second target boundary value belong to the same maximum value type, for example, when the second target boundary value belongs to the maximum value type, the second boundary value to be adjusted also belongs to the maximum value type, and the second boundary value to be adjusted is taken as the maximum boundary value in the attribute interval. When the second target boundary value belongs to the minimum value type, the second boundary value to be adjusted also belongs to the minimum value type, and the second boundary value to be adjusted is used as the minimum boundary value in the attribute interval.
It should be noted that the construction of the second maximum expression may be similar to that of the first maximum expression, and based on this, the construction operation of the second maximum expression may be referred to the construction operation of the first maximum expression described above.
After the first and second maximum expressions are obtained, the operation interval may be determined from the first and second maximum expressions. One of the first and second maximum expressions is used to determine a minimum boundary value in the operation section, and the other maximum expression is used to determine a maximum boundary value in the operation section, and the determined operation section may be expressed as having the maximum expression used to determine the minimum boundary value as the minimum boundary value and the maximum expression used to determine the maximum boundary value as the maximum boundary value.
For example, the first maximum expression is used to determine a boundary value of the maximum type, where the first maximum expression may be expressed as min (a max, B (1)), where B (1) is a first indirect value index object, and a max is a first boundary value to be adjusted in the attribute interval. The second most-valued expression is used to determine the boundary value of the minimum value type, where the second most-valued expression may be represented as max (a min, B (0)), where B (0) is a second indirect value index object and a min is the second boundary value to be adjusted in the attribute interval. Then the constructed run interval can be expressed as (max (a min,B(0)),min(Amax, B (1))).
Fig. 2C shows a schematic diagram of another example of determining an operation section of the embodiment of the present specification. As shown in fig. 2C, the minimum boundary value in the array a is the index value a min, and the first maximum expression determined correspondingly is min (a max, B (0)). The maximum boundary value in the array a is an index value a max, the corresponding determined second maximum expression is max (a min, B (0)), and the obtained operation interval is shown as (max (a min,B(0)),min(Amax, B (1)) according to the first maximum expression and the second maximum expression.
After the interval analysis determines the running interval, the compiled code may be output. For example, the interval object to be solved is an array a whose attribute interval is (0, 100). The sum computation is performed on the array a, the first indirect value index object that is the maximum boundary value in the running section of the array a is B (0), and B (0) is an element in the array B whose index value is 0. In the compiling stage for the array a, according to the interval analysis method provided in the embodiment of the present disclosure, the first maximum expression is obtained as min (100, b (0)), so that the operation interval of the obtained array a is: (0, min (100, B (0))). Further, the code that can be compiled to function correctly is as follows:
For x:(0,min(100,B(0))){
Result+=A[x]
}
Then, the operation phase for the section object to be solved is entered again. In the operation stage, an integer value corresponding to the first indirect value index object can be obtained from the memory, and the integer value is substituted into the first maximum value expression to calculate the value of the first maximum value expression. And substituting the numerical value into the operation interval to obtain a specific operation interval. When the operation interval obtained in the compiling stage further includes a second maximum expression obtained by the second indirect value index object, an integer value corresponding to the second indirect value index object may also be obtained from the memory, and the integer value is substituted into the second maximum expression, so as to calculate the value of the second maximum expression. And replacing the value with the second highest value expression in the operation interval, and replacing the value of the first highest value expression with the first highest value expression in the line interval, so that the operation interval with the minimum boundary value and the maximum boundary value being integer values can be obtained.
Fig. 3 shows a block diagram of one example of an interval analysis apparatus 300 for indirect boundaries according to an embodiment of the present specification.
In one example, the interval analysis apparatus 300 may be applied to a compiler.
As shown in fig. 3, the section analysis apparatus 300 includes an indirect value index object determination unit 310, a maximum value expression determination unit 320, and an operation section determination unit 330.
The indirect value index object determining unit 310 is configured to determine a first indirect value index object, which is a first target boundary value in the running interval of the interval object to be solved, where an integer value corresponding to the first indirect value index object is stored in the memory, and the first indirect value index object is defined as an integer type, and the interval object to be solved has a fixed attribute interval.
The maximum value expression determining unit 320 is configured to determine, according to the first indirect value index object and the first boundary value to be adjusted in the attribute interval, a first maximum value expression between the first indirect value index object and the first boundary value to be adjusted, where the first boundary value to be adjusted and the first target boundary value belong to the same maximum value type in the interval, and the first maximum value expression is used to determine boundary values belonging to the same maximum value type in the operation interval.
The operation interval determining unit 330 is configured to obtain an operation interval including the first maximum expression from the first maximum expression.
In one example, the operation interval determination unit 330 may be further configured to determine the operation interval from the first maximum value expression and the other boundary value when the other boundary value in the attribute interval is not adjusted.
In one example, the most-value expression determining unit 320 may be further configured to construct a second most-value expression between the second indirection value index object and the second boundary value to be adjusted according to the second indirection value index object that is the second target boundary value in the operation interval and the second boundary value to be adjusted in the attribute interval, where the integer value corresponding to the second indirection value index object is stored in the memory, the second indirection value index object is defined as the integer value, and the second boundary value to be adjusted and the second target boundary value belong to the same most-value type.
The operation interval determination unit 330 may be further configured to determine the operation interval from the first and second maximum expressions.
In one example, the maximum expression determining unit 320 may be further configured to determine that the maximum boundary value and the minimum boundary value are both the first interval of the first indirect value index object according to the first indirect value index object; and determining a first maximum expression formed by the first indirect value index object and the first boundary value to be adjusted according to the first interval and the attribute interval.
In one example, the maximum expression determination unit 320 may be further configured to determine the first indirect value index object and the first boundary value to be adjusted as the maximum comparison object to constitute the first maximum expression between the first indirect value index object and the first boundary value to be adjusted.
Embodiments of a section analysis method and a section analysis apparatus for indirect boundaries according to embodiments of the present specification are described above with reference to fig. 1 to 3.
The interval analysis device for indirect boundaries in the embodiments of the present specification may be implemented in hardware, or may be implemented in software or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a memory into a memory by a processor of a device where the device is located. In the embodiment of the present specification, the section analysis means for indirect boundaries may be implemented using an electronic device, for example.
Fig. 4 shows a block diagram of an electronic device 400 for implementing the interval analysis method of the indirect boundary according to the embodiment of the present specification.
As shown in fig. 4, electronic device 400 may include at least one processor 410, memory (e.g., non-volatile memory) 420, memory 430, and communication interface 440, and at least one processor 410, memory 420, memory 430, and communication interface 440 are connected together via bus 450. The at least one processor 410 executes at least one computer-readable instruction (i.e., the elements described above as being implemented in software) stored or encoded in memory.
In one embodiment, computer-executable instructions are stored in memory that, when executed, cause the at least one processor 410 to: determining a first indirect value index object serving as a first target boundary value in an operation interval of the interval object to be solved, wherein an integer value corresponding to the first indirect value index object is stored in a memory, the first indirect value index object is defined as an integer type, and the interval object to be solved has a fixed attribute interval; determining a first maximum expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and the first boundary value to be adjusted in the attribute interval, wherein the first boundary value to be adjusted and the first target boundary value belong to the same maximum type in the affiliated interval, and the first maximum expression is used for determining the boundary value belonging to the same maximum type in the operation interval; and obtaining an operation interval comprising the first maximum expression according to the first maximum expression.
It should be appreciated that the computer-executable instructions stored in the memory, when executed, cause the at least one processor 410 to perform the various operations and functions described above in connection with fig. 1-3 in various embodiments of the present specification.
According to one embodiment, a program product, such as a machine-readable medium, is provided. The machine-readable medium may have instructions (i.e., elements described above implemented in software) that, when executed by a machine, cause the machine to perform the various operations and functions described above in connection with fig. 1-3 in various embodiments of the specification.
In particular, a system or apparatus provided with a readable storage medium having stored thereon software program code implementing the functions of any of the above embodiments may be provided, and a computer or processor of the system or apparatus may be caused to read out and execute instructions stored in the readable storage medium.
In this case, the program code itself read from the readable medium may implement the functions of any of the above-described embodiments, and thus the machine-readable code and the readable storage medium storing the machine-readable code form part of the present invention.
Computer program code required for operation of portions of the present description may be written in any one or more programming languages, including an object oriented programming language such as Java, scala, smalltalk, eiffel, JADE, emerald, C ++, c#, VB, NET, python and the like, a conventional programming language such as C language, visual Basic 2003, perl, COBOL2002, PHP and ABAP, a dynamic programming language such as Python, ruby and Groovy, or other programming languages and the like. The program code may execute on the user's computer or as a stand-alone software package, or it may execute partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any form of network, such as a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet), or the connection may be made to the cloud computing environment, or for use as a service, such as software as a service (SaaS).
Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (e.g., CD-ROMs, CD-R, CD-RWs, DVD-ROMs, DVD-RAMs, DVD-RWs), magnetic tapes, nonvolatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or cloud by a communications network.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Not all steps or units in the above-mentioned flowcharts and system configuration diagrams are necessary, and some steps or units may be omitted according to actual needs. The order of execution of the steps is not fixed and may be determined as desired. The apparatus structures described in the above embodiments may be physical structures or logical structures, that is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or may be implemented jointly by some components in multiple independent devices.
The term "exemplary" used throughout this specification means "serving as an example, instance, or illustration," and does not mean "preferred" or "advantageous over other embodiments. The detailed description includes specific details for the purpose of providing an understanding of the described technology. However, the techniques may be practiced without these specific details. In some instances, well-known structures and devices are shown in block diagram form in order to avoid obscuring the concepts of the described embodiments.
The alternative implementation manner of the embodiment of the present disclosure has been described in detail above with reference to the accompanying drawings, but the embodiment of the present disclosure is not limited to the specific details of the foregoing implementation manner, and various simple modifications may be made to the technical solution of the embodiment of the present disclosure within the scope of the technical concept of the embodiment of the present disclosure, and all the simple modifications belong to the protection scope of the embodiment of the present disclosure.
The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (11)
1. A method of interval analysis for indirect boundaries, comprising:
Determining a first indirect value index object serving as a first target boundary value in an operation interval of an interval object to be solved, wherein an integer value corresponding to the first indirect value index object is stored in a memory, the first indirect value index object is defined as an integer type, the interval object to be solved has a fixed attribute interval, the interval object to be solved is an array in a test case, the test case is used for carrying out traversal summation on the array, and the operation interval defined by the array determines the number of array elements of the array summation when carrying out the traversal summation;
Determining a first maximum expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and the first boundary value to be adjusted in the attribute interval, wherein the first boundary value to be adjusted and the first target boundary value belong to the same maximum type in the interval, and the first maximum expression is used for determining boundary values belonging to the same maximum type in the operation interval; and
And obtaining the operation interval comprising the first maximum expression according to the first maximum expression.
2. The interval analysis method of claim 1, wherein deriving the running interval including the first maximum expression from the first maximum expression includes:
When another boundary value in the attribute interval is not adjusted, the run interval is determined from the first maximum expression and the another boundary value.
3. The interval analysis method as claimed in claim 1, further comprising:
Forming a second maximum expression between the second indirect value index object and the second boundary value to be adjusted according to a second indirect value index object serving as a second target boundary value in the operation interval and the second boundary value to be adjusted in the attribute interval, wherein an integer value corresponding to the second indirect value index object is stored in a memory, the second indirect value index object is defined as an integer value, and the second boundary value to be adjusted and the second target boundary value belong to the same maximum type; and
Obtaining the operation interval including the first maximum expression according to the first maximum expression includes:
The operation interval is determined by the first and second maximum expressions.
4. The interval analysis method of claim 1, wherein determining a first maximum expression between the first indirection value index object and the first boundary value to be adjusted according to the first indirection value index object and the first boundary value to be adjusted in the attribute interval comprises:
Determining that a maximum boundary value and a minimum boundary value are both a first interval of the first indirect value index object according to the first indirect value index object; and
And determining a first maximum expression formed by the first indirect value index object and the first boundary value to be adjusted according to the first interval and the attribute interval.
5. The interval analysis method of claim 1, wherein determining a first maximum expression between the first indirection value index object and the first boundary value to be adjusted according to the first indirection value index object and the first boundary value to be adjusted in the attribute interval comprises:
The first indirect value index object and the first boundary value to be adjusted are determined as the most value comparison object to form a first most value expression between the first indirect value index object and the first boundary value to be adjusted.
6. The interval analysis method as claimed in claim 1, wherein the interval analysis method is performed by a compiler.
7. The interval analysis method of claim 1, wherein the first indirect value index object comprises any one of an array, a vector, a matrix, and a tensor.
8. An interval analysis apparatus for indirect boundaries, comprising:
An indirect value index object determining unit, configured to determine a first indirect value index object serving as a first target boundary value in an operation interval of an interval object to be solved, where the first indirect value index object corresponds to an integer value stored in a memory, the first indirect value index object is defined as an integer type, the interval object to be solved has a fixed attribute interval, the interval object to be solved is an array in a test case, the test case is used for performing traversal summation on the array, and when performing the traversal summation, the operation interval defined by the array determines the number of array elements in the array summation;
A maximum value expression determining unit configured to determine a first maximum value expression between the first indirect value index object and the first boundary value to be adjusted according to the first indirect value index object and a first boundary value to be adjusted in the attribute interval, where the first boundary value to be adjusted and the first target boundary value belong to the same maximum value type in the interval, and the first maximum value expression is used to determine a boundary value belonging to the same maximum value type in the operation interval; and
And an operation interval determining unit configured to obtain the operation interval including the first maximum expression from the first maximum expression.
9. An electronic device, comprising: at least one processor, a memory coupled with the at least one processor, and a computer program stored on the memory, the at least one processor executing the computer program to implement the method of any of claims 1-7.
10. A computer readable storage medium storing a computer program which, when executed by a processor, implements the method of any of claims 1-7.
11. A computer program product comprising a computer program which, when executed by a processor, implements the method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111031113.4A CN113703776B (en) | 2021-09-03 | 2021-09-03 | Interval analysis method and device for indirect boundary |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111031113.4A CN113703776B (en) | 2021-09-03 | 2021-09-03 | Interval analysis method and device for indirect boundary |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113703776A CN113703776A (en) | 2021-11-26 |
CN113703776B true CN113703776B (en) | 2024-07-30 |
Family
ID=78659114
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111031113.4A Active CN113703776B (en) | 2021-09-03 | 2021-09-03 | Interval analysis method and device for indirect boundary |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113703776B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111046337A (en) * | 2019-12-18 | 2020-04-21 | 深圳前海环融联易信息科技服务有限公司 | Data interval value processing method and device, equipment and storage medium |
CN112346945A (en) * | 2020-10-23 | 2021-02-09 | 北京津发科技股份有限公司 | Man-machine interaction data analysis method and device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7062761B2 (en) * | 2001-07-10 | 2006-06-13 | Micron Technology, Inc. | Dynamic arrays and overlays with bounds policies |
US8484613B2 (en) * | 2010-01-28 | 2013-07-09 | Synopsys, Inc. | Optimizing bounds checking using computer algebra |
US11294921B2 (en) * | 2019-03-12 | 2022-04-05 | General Electric Company | Multivariate time-series data search |
WO2021051138A1 (en) * | 2019-09-12 | 2021-03-18 | Oracle International Corporation | Autonomously partitioning database tables |
-
2021
- 2021-09-03 CN CN202111031113.4A patent/CN113703776B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111046337A (en) * | 2019-12-18 | 2020-04-21 | 深圳前海环融联易信息科技服务有限公司 | Data interval value processing method and device, equipment and storage medium |
CN112346945A (en) * | 2020-10-23 | 2021-02-09 | 北京津发科技股份有限公司 | Man-machine interaction data analysis method and device |
Also Published As
Publication number | Publication date |
---|---|
CN113703776A (en) | 2021-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8533680B2 (en) | Approximating finite domains in symbolic state exploration | |
US10657025B2 (en) | Systems and methods for dynamically identifying data arguments and instrumenting source code | |
US20220012027A1 (en) | Inductive equivalence in machine-based instruction editing | |
CN111104335B (en) | A C language defect detection method and device based on multi-level analysis | |
US20130031531A1 (en) | Method and system for performing backward-driven path-sensitive dataflow analysis | |
CN104536883A (en) | Static defect detecting method and system thereof | |
US11507348B2 (en) | Method and apparatus for generating chip-based computing function, device, and storage medium | |
US20110145799A1 (en) | Path-sensitive dataflow analysis including path refinement | |
KR20100106409A (en) | Multi language software code analysis | |
CN112948828A (en) | Binary program malicious code detection method, terminal device and storage medium | |
JP6528465B2 (en) | State parameterization in symbolic execution for software testing | |
Dudina et al. | Using static symbolic execution to detect buffer overflows | |
CN113312618B (en) | Program vulnerability detection method, device, electronic device and medium | |
KR102110735B1 (en) | Method and system for re-generating binary for vulnerability detection | |
CN116432245A (en) | Method and system for automatically verifying intelligent contract business attribute in form | |
Clarisó et al. | Towards domain refinement for UML/OCL bounded verification | |
CN113703776B (en) | Interval analysis method and device for indirect boundary | |
KR102670476B1 (en) | System and method for analyzing contamination paths to analyze vulnerabilities in IoT devices | |
JP7188580B2 (en) | System and method for selectively instrumenting programs according to performance characteristics | |
Cortesi et al. | String abstraction for model checking of C programs | |
KR101947737B1 (en) | Method and apparatus for explicit and implicit information flow tracking | |
Letychevskyi et al. | Fuzz testing technique and its use in cybersecurity tasks | |
CN116069650A (en) | Method and device for generating test cases | |
Hu et al. | Deriving java virtual machine timing models for portable worst-case execution time analysis | |
CN112699376A (en) | Source code logic vulnerability detection method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |