Program: 110886
Project: 110886
Buggy source:
private void setupCompileBuildVariables(CppCompileActionBuilder builder,boolean usePic,PathFragment ccRelativeName,PathFragment autoFdoImportPath,Artifact gcnoFile,Artifact dwoFile){
  CcToolchainFeatures.Variables.Builder buildVariables=new CcToolchainFeatures.Variables.Builder();
  CppCompilationContext builderContext=builder.getContext();
  CppModuleMap cppModuleMap=builderContext.getCppModuleMap();
  Artifact sourceFile=builder.getSourceFile();
  Artifact outputFile=builder.getOutputFile();
  String realOutputFilePath;
  buildVariables.addVariable("String_Node_Str",sourceFile.getExecPathString());
  buildVariables.addVariable("String_Node_Str",outputFile.getExecPathString());
  if (fake) {
    realOutputFilePath=builder.getTempOutputFile().getPathString();
  }
 else {
    realOutputFilePath=builder.getOutputFile().getExecPathString();
  }
  if (FileType.contains(outputFile,CppFileTypes.ASSEMBLER,CppFileTypes.PIC_ASSEMBLER)) {
    buildVariables.addVariable("String_Node_Str",realOutputFilePath);
  }
 else   if (FileType.contains(outputFile,CppFileTypes.PREPROCESSED_C,CppFileTypes.PREPROCESSED_CPP,CppFileTypes.PIC_PREPROCESSED_C,CppFileTypes.PIC_PREPROCESSED_CPP)) {
    buildVariables.addVariable("String_Node_Str",realOutputFilePath);
  }
 else {
    buildVariables.addVariable("String_Node_Str",realOutputFilePath);
  }
  DotdFile dotdFile=CppFileTypes.mustProduceDotdFile(sourceFile.getPath().toString()) ? Preconditions.checkNotNull(builder.getDotdFile()) : null;
  if (dotdFile != null) {
    buildVariables.addVariable("String_Node_Str",dotdFile.getSafeExecPath().getPathString());
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.MODULE_MAPS) && cppModuleMap != null) {
    buildVariables.addVariable("String_Node_Str",cppModuleMap.getName());
    buildVariables.addVariable("String_Node_Str",cppModuleMap.getArtifact().getExecPathString());
    CcToolchainFeatures.Variables.ValueSequence.Builder sequence=new CcToolchainFeatures.Variables.ValueSequence.Builder();
    for (    Artifact artifact : builderContext.getDirectModuleMaps()) {
      sequence.addValue(artifact.getExecPathString());
    }
    buildVariables.addSequence("String_Node_Str",sequence.build());
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.USE_HEADER_MODULES)) {
    buildVariables.addSequenceVariable("String_Node_Str",getHeaderModulePaths(builder,usePic));
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.INCLUDE_PATHS)) {
    buildVariables.addSequenceVariable("String_Node_Str",getSafePathStrings(builderContext.getIncludeDirs()));
    buildVariables.addSequenceVariable("String_Node_Str",getSafePathStrings(builderContext.getQuoteIncludeDirs()));
    buildVariables.addSequenceVariable("String_Node_Str",getSafePathStrings(builderContext.getSystemIncludeDirs()));
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.PREPROCESSOR_DEFINES)) {
    String fdoBuildStamp=CppHelper.getFdoBuildStamp(ruleContext);
    ImmutableList<String> defines;
    if (fdoBuildStamp != null) {
      defines=ImmutableList.<String>builder().addAll(builderContext.getDefines()).add(CppConfiguration.FDO_STAMP_MACRO + "String_Node_Str" + CppHelper.getFdoBuildStamp(ruleContext)+ "String_Node_Str").build();
    }
 else {
      defines=builderContext.getDefines();
    }
    buildVariables.addSequenceVariable("String_Node_Str",defines);
  }
  if (usePic) {
    if (!featureConfiguration.isEnabled(CppRuleClasses.PIC)) {
      ruleContext.ruleError("String_Node_Str");
    }
    buildVariables.addVariable("String_Node_Str","String_Node_Str");
  }
  if (ccRelativeName != null) {
    CppHelper.getFdoSupport(ruleContext).configureCompilation(builder,buildVariables,ruleContext,ccRelativeName,autoFdoImportPath,usePic,featureConfiguration);
  }
  if (gcnoFile != null) {
    buildVariables.addVariable("String_Node_Str",gcnoFile.getExecPathString());
  }
  if (dwoFile != null) {
    buildVariables.addVariable("String_Node_Str",dwoFile.getExecPathString());
  }
  buildVariables.addAllVariables(CppHelper.getToolchain(ruleContext).getBuildVariables());
  for (  VariablesExtension extension : variablesExtensions) {
    extension.addVariables(buildVariables);
  }
  CcToolchainFeatures.Variables variables=buildVariables.build();
  builder.setVariables(variables);
}

Fixed version (ground truth):
private void setupCompileBuildVariables(CppCompileActionBuilder builder,boolean usePic,PathFragment ccRelativeName,PathFragment autoFdoImportPath,Artifact gcnoFile,Artifact dwoFile){
  CcToolchainFeatures.Variables.Builder buildVariables=new CcToolchainFeatures.Variables.Builder();
  CppCompilationContext builderContext=builder.getContext();
  CppModuleMap cppModuleMap=builderContext.getCppModuleMap();
  Artifact sourceFile=builder.getSourceFile();
  Artifact outputFile=builder.getOutputFile();
  String realOutputFilePath;
  buildVariables.addVariable("String_Node_Str",sourceFile.getExecPathString());
  buildVariables.addVariable("String_Node_Str",outputFile.getExecPathString());
  if (builder.getTempOutputFile() != null) {
    realOutputFilePath=builder.getTempOutputFile().getPathString();
  }
 else {
    realOutputFilePath=builder.getOutputFile().getExecPathString();
  }
  if (FileType.contains(outputFile,CppFileTypes.ASSEMBLER,CppFileTypes.PIC_ASSEMBLER)) {
    buildVariables.addVariable("String_Node_Str",realOutputFilePath);
  }
 else   if (FileType.contains(outputFile,CppFileTypes.PREPROCESSED_C,CppFileTypes.PREPROCESSED_CPP,CppFileTypes.PIC_PREPROCESSED_C,CppFileTypes.PIC_PREPROCESSED_CPP)) {
    buildVariables.addVariable("String_Node_Str",realOutputFilePath);
  }
 else {
    buildVariables.addVariable("String_Node_Str",realOutputFilePath);
  }
  DotdFile dotdFile=CppFileTypes.mustProduceDotdFile(sourceFile.getPath().toString()) ? Preconditions.checkNotNull(builder.getDotdFile()) : null;
  if (dotdFile != null) {
    buildVariables.addVariable("String_Node_Str",dotdFile.getSafeExecPath().getPathString());
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.MODULE_MAPS) && cppModuleMap != null) {
    buildVariables.addVariable("String_Node_Str",cppModuleMap.getName());
    buildVariables.addVariable("String_Node_Str",cppModuleMap.getArtifact().getExecPathString());
    CcToolchainFeatures.Variables.ValueSequence.Builder sequence=new CcToolchainFeatures.Variables.ValueSequence.Builder();
    for (    Artifact artifact : builderContext.getDirectModuleMaps()) {
      sequence.addValue(artifact.getExecPathString());
    }
    buildVariables.addSequence("String_Node_Str",sequence.build());
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.USE_HEADER_MODULES)) {
    buildVariables.addSequenceVariable("String_Node_Str",getHeaderModulePaths(builder,usePic));
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.INCLUDE_PATHS)) {
    buildVariables.addSequenceVariable("String_Node_Str",getSafePathStrings(builderContext.getIncludeDirs()));
    buildVariables.addSequenceVariable("String_Node_Str",getSafePathStrings(builderContext.getQuoteIncludeDirs()));
    buildVariables.addSequenceVariable("String_Node_Str",getSafePathStrings(builderContext.getSystemIncludeDirs()));
  }
  if (featureConfiguration.isEnabled(CppRuleClasses.PREPROCESSOR_DEFINES)) {
    String fdoBuildStamp=CppHelper.getFdoBuildStamp(ruleContext);
    ImmutableList<String> defines;
    if (fdoBuildStamp != null) {
      defines=ImmutableList.<String>builder().addAll(builderContext.getDefines()).add(CppConfiguration.FDO_STAMP_MACRO + "String_Node_Str" + CppHelper.getFdoBuildStamp(ruleContext)+ "String_Node_Str").build();
    }
 else {
      defines=builderContext.getDefines();
    }
    buildVariables.addSequenceVariable("String_Node_Str",defines);
  }
  if (usePic) {
    if (!featureConfiguration.isEnabled(CppRuleClasses.PIC)) {
      ruleContext.ruleError("String_Node_Str");
    }
    buildVariables.addVariable("String_Node_Str","String_Node_Str");
  }
  if (ccRelativeName != null) {
    CppHelper.getFdoSupport(ruleContext).configureCompilation(builder,buildVariables,ruleContext,ccRelativeName,autoFdoImportPath,usePic,featureConfiguration);
  }
  if (gcnoFile != null) {
    buildVariables.addVariable("String_Node_Str",gcnoFile.getExecPathString());
  }
  if (dwoFile != null) {
    buildVariables.addVariable("String_Node_Str",dwoFile.getExecPathString());
  }
  buildVariables.addAllVariables(CppHelper.getToolchain(ruleContext).getBuildVariables());
  for (  VariablesExtension extension : variablesExtensions) {
    extension.addVariables(buildVariables);
  }
  CcToolchainFeatures.Variables variables=buildVariables.build();
  builder.setVariables(variables);
}