-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The issue with the ARDiff testing program reporting errors. #3
Comments
Additionally, when I tested a more complex program using IRDiff, IMP-S, and DSE, none of the three tools were able to detect the code correctly. Below is the old version of the code:
} The new version of the code is as follows:
} The error message is as follows: ------------------------------------DSE----------------------------------- An error/exception occurred when instrumenting the files or running the equivalence checking. Please report this issue to us. java.io.IOException: Compilation error: Compilation error: ';' expected';' expected';' expected';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement ARDiff: ------------------------------------ARDIFF----------------------------------- An error/exception occurred when instrumenting the files or running the equivalence checking. Please report this issue to us. java.io.IOException: Compilation error: Compilation error: ';' expected';' expected';' expected';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected expectednot a statement';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement';' expected';' expected';' expected expectednot a statement IMP-S: ------------------------------------IMP-S----------------------------------- An error/exception occurred when instrumenting the files or running the equivalence checking. Please report this issue to us. java.io.IOException: Compilation error: Compilation error: method client in class demo.benchmarks.Airy.Sign.Eq.instrumented.IoldVImp cannot be applied to given types; How can this issue be resolved?Thank you for taking the time out of your busy schedule to help me with this issue! Looking forward to your reply. |
I'm sorry for the garbled code I provided you with in the four versions. Let me repost them here.
New version code of the first program:
Old version code of the second program:
New version code of the second program:
|
When I changed the variable "ratio" in the first program to be defined as a parameter in the function, the issue disappeared. However, this approach does not work for the second program. The old version of the first program with the modified parameter "ratio" is as follows:
The new version of the first program with the modified parameter "ratio" is as follows:
|
For the issue with the first program, the current version of ARDiff will not redefine the variables if they are in the common block (e.g., ration). That results in "cannot find symbol". The work around for this is what you did. Looking at the error for the second program, it seems the issue is with the instrumentation. I would suggest to copy the second program in the new directory (currently you are using Airy/Sign/Eg for both). The inconsistencies might come from using the temp files of the first program for the second one. Remove all the tool-created folders. |
Thank you for your patient explanation! Since the ratio variable is also declared within a function body in my second program, I first moved the ratio variable from the function body to the function parameters. Below is the modified code for the old version:
The modified new version of the code is as follows:
Afterwards, I created an empty folder and moved the files oldV.java and newV.java into it.Then, I proceeded to use ARDiff to detect the differences between the old and new versions of the code. The detection command is as follows:
ARDiff execution failed with the following error message:
DSE and IMP-S encountered the same issue, as shown below:
Do you know what might be causing this issue? Looking forward to your response. |
Hello! I've utilized ARDiff to test a program I've written myself. Below is the old version of the program:
public class oldV{ public static int snippet(int num, int den) { int ratio; if (num < 0 || den < 0) { ratio = -1; } else if (den == 0 || num == 0) { ratio = 0; } else if (den > 200 || num > 200) { ratio = 200; } else if (den < 2) { ratio = 2 * num; } else if (den < 4) { ratio = num - den; } else if (den < 8) { if (num < den) { ratio = num; } else { ratio = den; } } else if (den < 16) { if (num > den) { ratio = num; } else { ratio = den; } } else if (den < 32) { ratio = 32; for (int i = 2; i < 32; i++) { if (num % i == 0) { ratio = i; break; } } } else if (den < 64) { ratio = 64; for (int i = 2; i < 64; i++) { if (den % i == 0) { ratio = i; break; } } } else if (den < 128) { int x = den; int y = num; int z = x + y; for (int i = 1; i < 30; i++) { z = x + y; x = y; y = z; } ratio = z; } else { ratio = den + num + 10; } return ratio; } }
The new version of the code is as follows:
public class newV{ public static int snippet(int num, int den) { int ratio; if (num < 0 || den < 0) { ratio = -1; } else if (den == 0 || num == 0) { ratio = 0; } else if (den > 200 || num > 200) { ratio = 200; } else if (den < 2) { ratio = 2 * num; } else if (den < 4) { ratio = num - den; } else if (den < 8) { if (num < den) { ratio = num; } else { ratio = den; } } else if (den < 16) { if (num > den) { ratio = num; } else { ratio = den; } } else if (den < 32) { ratio = 32; for (int i = 2; i < 32; i++) { if (num % i == 0) { ratio = i; break; } } } else if (den < 64) { ratio = 64; for (int i = 2; i < 64; i++) { if (den % i == 0) { ratio = i; break; } } } else if (den < 128) { int x = den; int y = num; int z = x + y; for (int i = 1; i < 30; i++) { z = x + y; x = y; y = z; } ratio = y; } else { ratio = den + num + 10; } return ratio; } }
When I use IMP-S to test the code, IMP-S can provide correct results. However, when I use DSE and ARDiff to test the program, the tools report errors as follows:
`*****************************************************************************
------------------------------------ARDIFF-----------------------------------
An error/exception occurred when instrumenting the files or running the equivalence checking. Please report this issue to us.
java.io.IOException: Compilation error: Compilation error: cannot find symbol
symbol: variable ratio
location: class demo.benchmarks.Airy.Sign.Eq.instrumented.IoldVARDiffcannot find symbol
symbol: variable ratio
location: class demo.benchmarks.Airy.Sign.Eq.instrumented.IoldVARDiff
at equiv.checking.Utils.compile(Utils.java:69)
at equiv.checking.Instrumentation.saveNewProcedure(Instrumentation.java:312)
at DSE.DSE.runEquivalenceChecking(DSE.java:272)
at GradDiff.GradDiff.runTool(GradDiff.java:90)
at Runner.Runner.runTool(Runner.java:163)
at Runner.Runner.main(Runner.java:472)`
The detection instructions I used are:java -Djava.library.path=jpf-git/jpf-symbc/lib -jar target/artifacts/Implementation_jar/Implementation.jar --path1 /project/ARDiff/benchmarks/Airy/Sign/Eq/oldV.java --path2 /project/ARDiff/benchmarks/Airy/Sign/Eq/newV.java --tool A --s coral --b 3
I replaced the files in the /benchmarks/Airy/Sign/Eq directory of the test suite with my own code. Therefore, the error message indicates that the error occurred in the demo.benchmarks.Airy.Sign.Eq directory.
The error message indicates that the symbol "ratio" was not found. I attempted to redefine "ratio" within the function snippet instead of as a standalone entity. Here is an example of how it is done:
'public class oldV{
public static int snippet(int num, int den,int ratio) {
if (num < 0 || den < 0) {
ratio = -1;
} else if (den == 0 || num == 0) {
ratio = 0;
} else if (den > 200 || num > 200) {
ratio = 200;
} else if (den < 2) {
ratio = 2 * num;
} else if (den < 4) {
ratio = num - den;
} else if (den < 8) {
if (num < den) {
ratio = num;
} else {
ratio = den;
}
} else if (den < 16) {
if (num > den) {
ratio = num;
} else {
ratio = den;
}
} else if (den < 32) {
ratio = 32;
for (int i = 2; i < 32; i++) {
if (num % i == 0) {
ratio = i;
break;
}
}
} else if (den < 64) {
ratio = 64;
for (int i = 2; i < 64; i++) {
if (den % i == 0) {
ratio = i;
break;
}
}
} else if (den < 128) {
int x = den;
int y = num;
int z = x + y;
for (int i = 1; i < 30; i++) {
z = x + y;
x = y;
y = z;
}
ratio = z;
} else {
ratio = den + num + 10;
}
return ratio;
}
}'
After making this modification, ARDiff no longer reports this error. Do you happen to know the reason behind this problem?
The text was updated successfully, but these errors were encountered: