Program: 19491
Project: 19491
Buggy source:
/** 
 * Parses command-line arguments and runs the compiler.
 * @return system exit status
 */
protected int doRun() throws FlagUsageException, IOException {
  Compiler.setLoggingLevel(Level.parse(config.loggingLevel));
  compiler=createCompiler();
  B options=createOptions();
  List<SourceFile> externs=createExterns(options);
  List<JSModule> modules=null;
  Result result=null;
  setRunOptions(options);
  boolean writeOutputToFile=!config.jsOutputFile.isEmpty();
  List<String> outputFileNames=new ArrayList<>();
  if (writeOutputToFile) {
    outputFileNames.add(config.jsOutputFile);
  }
  List<String> moduleSpecs=config.module;
  List<JsonFileSpec> jsonFiles=null;
  if (config.jsonStreamMode == JsonStreamMode.IN || config.jsonStreamMode == JsonStreamMode.BOTH) {
    jsonFiles=parseJsonFilesFromInputStream();
    ImmutableMap.Builder<String,SourceMapInput> inputSourceMaps=new ImmutableMap.Builder<>();
    boolean foundJsonInputSourceMap=false;
    for (    JsonFileSpec jsonFile : jsonFiles) {
      if (jsonFile.getSourceMap() != null && jsonFile.getSourceMap().length() > 0) {
        String sourceMapPath=jsonFile.getPath() + "String_Node_Str";
        SourceFile sourceMap=SourceFile.fromCode(sourceMapPath,jsonFile.getSourceMap());
        inputSourceMaps.put(sourceMapPath,new SourceMapInput(sourceMap));
        foundJsonInputSourceMap=true;
      }
    }
    if (foundJsonInputSourceMap) {
      inputSourceMaps.putAll(options.inputSourceMaps);
      options.inputSourceMaps=inputSourceMaps.build();
    }
  }
  boolean createCommonJsModules=false;
  if (options.processCommonJSModules && (moduleSpecs.size() == 1 && "String_Node_Str".equals(moduleSpecs.get(0)))) {
    createCommonJsModules=true;
    moduleSpecs.remove(0);
  }
  List<SourceFile> inputs=createSourceInputs(config.mixedJsSources,jsonFiles);
  if (!moduleSpecs.isEmpty()) {
    modules=createJsModules(moduleSpecs,inputs);
    for (    JSModule m : modules) {
      outputFileNames.add(getModuleOutputFileName(m));
    }
    if (config.skipNormalOutputs) {
      compiler.initModules(externs,modules,options);
    }
 else {
      result=compiler.compileModules(externs,modules,options);
    }
  }
 else {
    if (config.skipNormalOutputs) {
      compiler.init(externs,inputs,options);
      compiler.hoistExterns();
    }
 else {
      result=compiler.compile(externs,inputs,options);
    }
  }
  if (createCommonJsModules) {
    modules=ImmutableList.copyOf(compiler.getDegenerateModuleGraph().getAllModules());
    for (    JSModule m : modules) {
      outputFileNames.add(getModuleOutputFileName(m));
    }
  }
  for (  String outputFileName : outputFileNames) {
    if (compiler.getSourceFileByName(outputFileName) != null) {
      compiler.report(JSError.make(OUTPUT_SAME_AS_INPUT_ERROR,outputFileName));
      return 1;
    }
  }
  return processResults(result,modules,options);
}

Fixed version (ground truth):
/** 
 * Parses command-line arguments and runs the compiler.
 * @return system exit status
 */
protected int doRun() throws FlagUsageException, IOException {
  Compiler.setLoggingLevel(Level.parse(config.loggingLevel));
  compiler=createCompiler();
  B options=createOptions();
  List<SourceFile> externs=createExterns(options);
  List<JSModule> modules=null;
  Result result=null;
  setRunOptions(options);
  boolean writeOutputToFile=!config.jsOutputFile.isEmpty();
  List<String> outputFileNames=new ArrayList<>();
  if (writeOutputToFile) {
    outputFileNames.add(config.jsOutputFile);
  }
  boolean createCommonJsModules=false;
  if (options.processCommonJSModules && (config.module.size() == 1 && "String_Node_Str".equals(config.module.get(0)))) {
    createCommonJsModules=true;
    config.module.remove(0);
  }
  List<JsModuleSpec> jsModuleSpecs=new ArrayList<>();
  for (int i=0; i < config.module.size(); i++) {
    jsModuleSpecs.add(JsModuleSpec.create(config.module.get(i),i == 0));
  }
  List<JsonFileSpec> jsonFiles=null;
  if (config.jsonStreamMode == JsonStreamMode.IN || config.jsonStreamMode == JsonStreamMode.BOTH) {
    jsonFiles=parseJsonFilesFromInputStream();
    ImmutableMap.Builder<String,SourceMapInput> inputSourceMaps=new ImmutableMap.Builder<>();
    boolean foundJsonInputSourceMap=false;
    for (    JsonFileSpec jsonFile : jsonFiles) {
      if (jsonFile.getSourceMap() != null && jsonFile.getSourceMap().length() > 0) {
        String sourceMapPath=jsonFile.getPath() + "String_Node_Str";
        SourceFile sourceMap=SourceFile.fromCode(sourceMapPath,jsonFile.getSourceMap());
        inputSourceMaps.put(sourceMapPath,new SourceMapInput(sourceMap));
        foundJsonInputSourceMap=true;
      }
    }
    if (foundJsonInputSourceMap) {
      inputSourceMaps.putAll(options.inputSourceMaps);
      options.inputSourceMaps=inputSourceMaps.build();
    }
  }
  List<SourceFile> inputs=createSourceInputs(jsModuleSpecs,config.mixedJsSources,jsonFiles);
  if (!jsModuleSpecs.isEmpty()) {
    modules=createJsModules(jsModuleSpecs,inputs);
    for (    JSModule m : modules) {
      outputFileNames.add(getModuleOutputFileName(m));
    }
    if (config.skipNormalOutputs) {
      compiler.initModules(externs,modules,options);
    }
 else {
      result=compiler.compileModules(externs,modules,options);
    }
  }
 else {
    if (config.skipNormalOutputs) {
      compiler.init(externs,inputs,options);
      compiler.hoistExterns();
    }
 else {
      result=compiler.compile(externs,inputs,options);
    }
  }
  if (createCommonJsModules) {
    modules=ImmutableList.copyOf(compiler.getDegenerateModuleGraph().getAllModules());
    for (    JSModule m : modules) {
      outputFileNames.add(getModuleOutputFileName(m));
    }
  }
  for (  String outputFileName : outputFileNames) {
    if (compiler.getSourceFileByName(outputFileName) != null) {
      compiler.report(JSError.make(OUTPUT_SAME_AS_INPUT_ERROR,outputFileName));
      return 1;
    }
  }
  return processResults(result,modules,options);
}