From ff3ceae6b47a1a01bc56fa55fa5770cba0bf252f Mon Sep 17 00:00:00 2001 From: yeom Date: Thu, 2 Aug 2012 21:06:46 +0000 Subject: [PATCH] fixed another problem of the flow-down check. If an assignment statement has OP+EQ operator(eg,+=,*=), calculate GLB of LHS & RHS and then assign it as the location type of RHS. + annotation fixes according to fix. --- Robust/src/Analysis/SSJava/FlowDownCheck.java | 26 ++++++++----------- .../SSJava/EyeTracking/Classifier.java | 2 +- .../SSJava/MP3Decoder/BitReserve.java | 2 +- .../SSJava/MP3Decoder/LayerIIIDecoder.java | 2 +- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Robust/src/Analysis/SSJava/FlowDownCheck.java b/Robust/src/Analysis/SSJava/FlowDownCheck.java index a16a6e9f..f466b0ed 100644 --- a/Robust/src/Analysis/SSJava/FlowDownCheck.java +++ b/Robust/src/Analysis/SSJava/FlowDownCheck.java @@ -1563,8 +1563,6 @@ public class FlowDownCheck { private CompositeLocation checkLocationFromAssignmentNode(MethodDescriptor md, SymbolTable nametable, AssignmentNode an, CompositeLocation loc, CompositeLocation constraint) { - // System.out.println("\n# ASSIGNMENTNODE=" + an.printNode(0)); - ClassDescriptor cd = md.getClassDesc(); Set inputGLBSet = new HashSet(); @@ -1592,20 +1590,22 @@ public class FlowDownCheck { checkLocationFromExpressionNode(md, nametable, an.getSrc(), new CompositeLocation(), constraint, false); - srcLocation = rhsLocation; + if (an.getOperation().getOp() >= 2 && an.getOperation().getOp() <= 12) { + // if assignment contains OP+EQ operator, need to merge location types + // of LHS & RHS into the RHS + Set srcGLBSet = new HashSet(); + srcGLBSet.add(rhsLocation); + srcGLBSet.add(destLocation); + srcLocation = CompositeLattice.calculateGLB(srcGLBSet, generateErrorMessage(cd, an)); + } else { + srcLocation = rhsLocation; + } - // if (!rhsLocation.get(rhsLocation.getSize() - 1).isTop()) { if (constraint != null) { - inputGLBSet.add(rhsLocation); + inputGLBSet.add(srcLocation); inputGLBSet.add(constraint); srcLocation = CompositeLattice.calculateGLB(inputGLBSet, generateErrorMessage(cd, an)); } - // } - - // System.out.println("dstLocation=" + destLocation); - // System.out.println("rhsLocation=" + rhsLocation); - // System.out.println("srcLocation=" + srcLocation); - // System.out.println("constraint=" + constraint); if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) { @@ -1643,10 +1643,6 @@ public class FlowDownCheck { srcLocation = rhsLocation; } - // System.out.println("srcLocation=" + srcLocation); - // System.out.println("rhsLocation=" + rhsLocation); - // System.out.println("constraint=" + constraint); - if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) { if (srcLocation.equals(destLocation)) { diff --git a/Robust/src/Benchmarks/SSJava/EyeTracking/Classifier.java b/Robust/src/Benchmarks/SSJava/EyeTracking/Classifier.java index f5a3c6de..ec19504c 100644 --- a/Robust/src/Benchmarks/SSJava/EyeTracking/Classifier.java +++ b/Robust/src/Benchmarks/SSJava/EyeTracking/Classifier.java @@ -74,7 +74,7 @@ public class Classifier { * @param translationY * @return true if this region was classified as face, else false */ - @LATTICE("OUT