Program: 2927
Project: 2927
Buggy source:
private void applyHorizontalSizeRules(LayoutParams childParams,int myWidth){
  final int layoutDirection=getLayoutDirection();
  int[] rules=childParams.getRules(layoutDirection);
  RelativeLayout.LayoutParams anchorParams;
  childParams.mLeft=-1;
  childParams.mRight=-1;
  anchorParams=getRelatedViewParams(rules,LEFT_OF);
  if (anchorParams != null) {
    childParams.mRight=anchorParams.mLeft - (anchorParams.leftMargin + childParams.rightMargin);
  }
 else   if (childParams.alignWithParent && rules[LEFT_OF] != 0) {
    if (myWidth >= 0) {
      childParams.mRight=myWidth - mPaddingRight - childParams.rightMargin;
    }
 else {
    }
  }
  anchorParams=getRelatedViewParams(rules,RIGHT_OF);
  if (anchorParams != null) {
    childParams.mLeft=anchorParams.mRight + (anchorParams.rightMargin + childParams.leftMargin);
  }
 else   if (childParams.alignWithParent && rules[RIGHT_OF] != 0) {
    childParams.mLeft=mPaddingLeft + childParams.leftMargin;
  }
  anchorParams=getRelatedViewParams(rules,ALIGN_LEFT);
  if (anchorParams != null) {
    childParams.mLeft=anchorParams.mLeft + childParams.leftMargin;
  }
 else   if (childParams.alignWithParent && rules[ALIGN_LEFT] != 0) {
    childParams.mLeft=mPaddingLeft + childParams.leftMargin;
  }
  anchorParams=getRelatedViewParams(rules,ALIGN_RIGHT);
  if (anchorParams != null) {
    childParams.mRight=anchorParams.mRight - childParams.rightMargin;
  }
 else   if (childParams.alignWithParent && rules[ALIGN_RIGHT] != 0) {
    if (myWidth >= 0) {
      childParams.mRight=myWidth - mPaddingRight - childParams.rightMargin;
    }
 else {
    }
  }
  if (0 != rules[ALIGN_PARENT_LEFT]) {
    childParams.mLeft=mPaddingLeft + childParams.leftMargin;
  }
  if (0 != rules[ALIGN_PARENT_RIGHT]) {
    if (myWidth >= 0) {
      childParams.mRight=myWidth - mPaddingRight - childParams.rightMargin;
    }
 else {
    }
  }
}

Fixed version (ground truth):
private void applyHorizontalSizeRules(LayoutParams childParams,int myWidth,int[] rules){
  RelativeLayout.LayoutParams anchorParams;
  childParams.mLeft=-1;
  childParams.mRight=-1;
  anchorParams=getRelatedViewParams(rules,LEFT_OF);
  if (anchorParams != null) {
    childParams.mRight=anchorParams.mLeft - (anchorParams.leftMargin + childParams.rightMargin);
  }
 else   if (childParams.alignWithParent && rules[LEFT_OF] != 0) {
    if (myWidth >= 0) {
      childParams.mRight=myWidth - mPaddingRight - childParams.rightMargin;
    }
 else {
    }
  }
  anchorParams=getRelatedViewParams(rules,RIGHT_OF);
  if (anchorParams != null) {
    childParams.mLeft=anchorParams.mRight + (anchorParams.rightMargin + childParams.leftMargin);
  }
 else   if (childParams.alignWithParent && rules[RIGHT_OF] != 0) {
    childParams.mLeft=mPaddingLeft + childParams.leftMargin;
  }
  anchorParams=getRelatedViewParams(rules,ALIGN_LEFT);
  if (anchorParams != null) {
    childParams.mLeft=anchorParams.mLeft + childParams.leftMargin;
  }
 else   if (childParams.alignWithParent && rules[ALIGN_LEFT] != 0) {
    childParams.mLeft=mPaddingLeft + childParams.leftMargin;
  }
  anchorParams=getRelatedViewParams(rules,ALIGN_RIGHT);
  if (anchorParams != null) {
    childParams.mRight=anchorParams.mRight - childParams.rightMargin;
  }
 else   if (childParams.alignWithParent && rules[ALIGN_RIGHT] != 0) {
    if (myWidth >= 0) {
      childParams.mRight=myWidth - mPaddingRight - childParams.rightMargin;
    }
 else {
    }
  }
  if (0 != rules[ALIGN_PARENT_LEFT]) {
    childParams.mLeft=mPaddingLeft + childParams.leftMargin;
  }
  if (0 != rules[ALIGN_PARENT_RIGHT]) {
    if (myWidth >= 0) {
      childParams.mRight=myWidth - mPaddingRight - childParams.rightMargin;
    }
 else {
    }
  }
}