Program: 40562
Project: 40562
Buggy source:
/** 
 * Generate constraints which assign exception values into an exception pointer
 * @param node governing node
 * @param peis list of PEI instructions
 * @param exceptionVar PointerKey representing a pointer to an exception value
 * @param catchClasses the types "caught" by the exceptionVar
 */
private void addExceptionDefConstraints(IR ir,DefUse du,CGNode node,List<ProgramCounter> peis,PointerKey exceptionVar,Set catchClasses){
  if (DEBUG) {
    System.err.println("String_Node_Str" + node);
  }
  for (Iterator<ProgramCounter> it=peis.iterator(); it.hasNext(); ) {
    ProgramCounter peiLoc=it.next();
    if (DEBUG) {
      System.err.println("String_Node_Str" + peiLoc);
    }
    SSAInstruction pei=ir.getPEI(peiLoc);
    if (DEBUG) {
      System.err.println("String_Node_Str" + pei);
    }
    if (pei instanceof SSAAbstractInvokeInstruction) {
      SSAAbstractInvokeInstruction s=(SSAAbstractInvokeInstruction)pei;
      PointerKey e=getPointerKeyForLocal(node,s.getException());
      if (!SHORT_CIRCUIT_SINGLE_USES || !hasUniqueCatchBlock(s,ir)) {
        addAssignmentsForCatchPointerKey(exceptionVar,catchClasses,e);
      }
    }
 else     if (pei instanceof SSAAbstractThrowInstruction) {
      SSAAbstractThrowInstruction s=(SSAAbstractThrowInstruction)pei;
      PointerKey e=getPointerKeyForLocal(node,s.getException());
      if (contentsAreInvariant(ir.getSymbolTable(),du,s.getException())) {
        InstanceKey[] ik=getInvariantContents(ir.getSymbolTable(),du,node,s.getException(),this);
        for (int i=0; i < ik.length; i++) {
          system.findOrCreateIndexForInstanceKey(ik[i]);
          assignInstanceToCatch(exceptionVar,catchClasses,ik[i]);
        }
      }
 else {
        addAssignmentsForCatchPointerKey(exceptionVar,catchClasses,e);
      }
    }
    Collection<TypeReference> types=pei.getExceptionTypes();
    if (types != null) {
      for (Iterator<TypeReference> it2=types.iterator(); it2.hasNext(); ) {
        TypeReference type=it2.next();
        if (type != null) {
          InstanceKey ik=getInstanceKeyForPEI(node,peiLoc,type,instanceKeyFactory);
          if (Assertions.verifyAssertions) {
            if (!(ik instanceof ConcreteTypeKey)) {
              Assertions._assert(ik instanceof ConcreteTypeKey,"String_Node_Str" + ik);
            }
          }
          ConcreteTypeKey ck=(ConcreteTypeKey)ik;
          IClass klass=ck.getType();
          if (PropagationCallGraphBuilder.catches(catchClasses,klass,cha)) {
            system.newConstraint(exceptionVar,getInstanceKeyForPEI(node,peiLoc,type,instanceKeyFactory));
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generate constraints which assign exception values into an exception pointer
 * @param node governing node
 * @param peis list of PEI instructions
 * @param exceptionVar PointerKey representing a pointer to an exception value
 * @param catchClasses the types "caught" by the exceptionVar
 */
private void addExceptionDefConstraints(IR ir,DefUse du,CGNode node,List<ProgramCounter> peis,PointerKey exceptionVar,Set catchClasses){
  if (DEBUG) {
    System.err.println("String_Node_Str" + node);
  }
  for (Iterator<ProgramCounter> it=peis.iterator(); it.hasNext(); ) {
    ProgramCounter peiLoc=it.next();
    if (DEBUG) {
      System.err.println("String_Node_Str" + peiLoc);
    }
    SSAInstruction pei=ir.getPEI(peiLoc);
    if (DEBUG) {
      System.err.println("String_Node_Str" + pei);
    }
    if (pei instanceof SSAAbstractInvokeInstruction) {
      SSAAbstractInvokeInstruction s=(SSAAbstractInvokeInstruction)pei;
      PointerKey e=getPointerKeyForLocal(node,s.getException());
      if (!SHORT_CIRCUIT_SINGLE_USES || !hasUniqueCatchBlock(s,ir)) {
        addAssignmentsForCatchPointerKey(exceptionVar,catchClasses,e);
      }
    }
 else     if (pei instanceof SSAAbstractThrowInstruction) {
      SSAAbstractThrowInstruction s=(SSAAbstractThrowInstruction)pei;
      PointerKey e=getPointerKeyForLocal(node,s.getException());
      if (contentsAreInvariant(ir.getSymbolTable(),du,s.getException())) {
        InstanceKey[] ik=getInvariantContents(ir.getSymbolTable(),du,node,s.getException(),this);
        for (int i=0; i < ik.length; i++) {
          system.findOrCreateIndexForInstanceKey(ik[i]);
          assignInstanceToCatch(exceptionVar,catchClasses,ik[i]);
        }
      }
 else {
        addAssignmentsForCatchPointerKey(exceptionVar,catchClasses,e);
      }
    }
    Collection<TypeReference> types=pei.getExceptionTypes();
    if (types != null) {
      for (Iterator<TypeReference> it2=types.iterator(); it2.hasNext(); ) {
        TypeReference type=it2.next();
        if (type != null) {
          InstanceKey ik=getInstanceKeyForPEI(node,peiLoc,type,instanceKeyFactory);
          if (ik == null) {
            continue;
          }
          if (Assertions.verifyAssertions) {
            if (!(ik instanceof ConcreteTypeKey)) {
              Assertions._assert(ik instanceof ConcreteTypeKey,"String_Node_Str" + ik);
            }
          }
          ConcreteTypeKey ck=(ConcreteTypeKey)ik;
          IClass klass=ck.getType();
          if (PropagationCallGraphBuilder.catches(catchClasses,klass,cha)) {
            system.newConstraint(exceptionVar,getInstanceKeyForPEI(node,peiLoc,type,instanceKeyFactory));
          }
        }
      }
    }
  }
}