Program: 5493
Project: 5493
Buggy source:
public MSP430Core(int type,ComponentRegistry registry,MSP430Config config){
  super("String_Node_Str","String_Node_Str",null);
  MAX_INTERRUPT=config.maxInterruptVector;
  MAX_MEM_IO=config.maxMemIO;
  MAX_MEM=config.maxMem;
  MSP430XArch=config.MSP430XArch;
  memory=new int[MAX_MEM];
  memorySegments=new Memory[MAX_MEM >> 8];
  flash=new Flash(this,memory,new FlashRange(config.mainFlashStart,config.mainFlashStart + config.mainFlashSize,512,64),new FlashRange(config.infoMemStart,config.infoMemStart + config.infoMemSize,128,64),config.flashControllerOffset);
  currentSegment=new Memory(){
    @Override public int read(    int address,    AccessMode mode,    AccessType type) throws EmulationException {
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + MSP430Core.this.config.getAddressAsString(address));
      }
      return memorySegments[address >> 8].read(address,mode,type);
    }
    @Override public void write(    int dstAddress,    int data,    AccessMode mode) throws EmulationException {
      if (dstAddress >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + MSP430Core.this.config.getAddressAsString(dstAddress));
      }
      memorySegments[dstAddress >> 8].write(dstAddress,data,mode);
    }
    @Override public int get(    int address,    AccessMode mode){
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + MSP430Core.this.config.getAddressAsString(address));
      }
      return memorySegments[address >> 8].get(address,mode);
    }
    @Override public void set(    int address,    int data,    AccessMode mode){
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + MSP430Core.this.config.getAddressAsString(address));
      }
      memorySegments[address >> 8].set(address,data,mode);
    }
  }
;
  IOUnit voidIO=new IOUnit("String_Node_Str",cpu,memory,0){
    public void interruptServiced(    int vector){
    }
    public void write(    int address,    int value,    boolean word,    long cycles){
      logw("String_Node_Str" + Utils.hex(address,4));
    }
    public int read(    int address,    boolean word,    long cycles){
      logw("String_Node_Str" + Utils.hex(address,4));
      return 0;
    }
  }
;
  int maxSeg=MAX_MEM >> 8;
  Memory ramSegment=new RAMSegment(this);
  Memory flashSegment=new FlashSegment(this,flash);
  IOSegment ioSegment=new IOSegment(this,MAX_MEM_IO,voidIO);
  Memory noMemorySegment=new NoMemSegment(this);
  for (int i=0; i < maxSeg; i++) {
    if (config.isRAM(i << 8)) {
      memorySegments[i]=ramSegment;
    }
 else     if (config.isFlash(i << 8) || config.isInfoMem(i << 8)) {
      memorySegments[i]=flashSegment;
    }
 else     if (config.isIO(i << 8)) {
      memorySegments[i]=ioSegment;
    }
 else {
      memorySegments[i]=noMemorySegment;
    }
  }
  this.registry=registry;
  this.config=config;
  addChip(this);
  setModeNames(MODE_NAMES);
  ioUnits=new ArrayList<IOUnit>();
  ioSegment.setIORange(config.flashControllerOffset,6,flash);
  sfr=new SFR(this,memory);
  ioSegment.setIORange(config.sfrOffset,0x10,sfr);
  Timer[] timers=new Timer[config.timerConfig.length];
  for (int i=0; i < config.timerConfig.length; i++) {
    Timer t=new Timer(this,memory,config.timerConfig[i]);
    ioSegment.setIORange(config.timerConfig[i].offset,0x20,t);
    ioSegment.setIORange(config.timerConfig[i].timerIVAddr,1,t);
    timers[i]=t;
  }
  bcs=config.createClockSystem(this,memory,timers);
  ioSegment.setIORange(bcs.getAddressRangeMin(),bcs.getAddressRangeMax() - bcs.getAddressRangeMin() + 1,bcs);
  ioUnits.add(sfr);
  ioUnits.add(bcs);
  config.setup(this,ioUnits);
  for (int i=0; i < timers.length; i++) {
    ioUnits.add(timers[i]);
  }
  watchdog=new Watchdog(this);
  ioSegment.setIORange(config.watchdogOffset,1,watchdog);
  ioUnits.add(watchdog);
  bcs.reset(0);
}

Fixed version (ground truth):
public MSP430Core(int type,ComponentRegistry registry,MSP430Config config){
  super("String_Node_Str","String_Node_Str",null);
  MAX_INTERRUPT=config.maxInterruptVector;
  MAX_MEM_IO=config.maxMemIO;
  MAX_MEM=config.maxMem;
  MSP430XArch=config.MSP430XArch;
  memory=new int[MAX_MEM];
  memorySegments=new Memory[MAX_MEM >> 8];
  flash=new Flash(this,memory,new FlashRange(config.mainFlashStart,config.mainFlashStart + config.mainFlashSize,512,64),new FlashRange(config.infoMemStart,config.infoMemStart + config.infoMemSize,128,64),config.flashControllerOffset);
  currentSegment=new Memory(){
    @Override public int read(    int address,    AccessMode mode,    AccessType type) throws EmulationException {
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + Utils.hex(address,4));
      }
      return memorySegments[address >> 8].read(address,mode,type);
    }
    @Override public void write(    int address,    int data,    AccessMode mode) throws EmulationException {
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + Utils.hex(address,4));
      }
      memorySegments[address >> 8].write(address,data,mode);
    }
    @Override public int get(    int address,    AccessMode mode){
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + Utils.hex(address,4));
      }
      return memorySegments[address >> 8].get(address,mode);
    }
    @Override public void set(    int address,    int data,    AccessMode mode){
      if (address >= MAX_MEM) {
        throw new EmulationException("String_Node_Str" + Utils.hex(address,4));
      }
      memorySegments[address >> 8].set(address,data,mode);
    }
  }
;
  IOUnit voidIO=new IOUnit("String_Node_Str",cpu,memory,0){
    public void interruptServiced(    int vector){
    }
    public void write(    int address,    int value,    boolean word,    long cycles){
      logw("String_Node_Str" + Utils.hex(address,4));
    }
    public int read(    int address,    boolean word,    long cycles){
      logw("String_Node_Str" + Utils.hex(address,4));
      return 0;
    }
  }
;
  int maxSeg=MAX_MEM >> 8;
  Memory ramSegment=new RAMSegment(this);
  Memory flashSegment=new FlashSegment(this,flash);
  IOSegment ioSegment=new IOSegment(this,MAX_MEM_IO,voidIO);
  Memory noMemorySegment=new NoMemSegment(this);
  for (int i=0; i < maxSeg; i++) {
    if (config.isRAM(i << 8)) {
      memorySegments[i]=ramSegment;
    }
 else     if (config.isFlash(i << 8) || config.isInfoMem(i << 8)) {
      memorySegments[i]=flashSegment;
    }
 else     if (config.isIO(i << 8)) {
      memorySegments[i]=ioSegment;
    }
 else {
      memorySegments[i]=noMemorySegment;
    }
  }
  this.registry=registry;
  this.config=config;
  addChip(this);
  setModeNames(MODE_NAMES);
  ioUnits=new ArrayList<IOUnit>();
  ioSegment.setIORange(config.flashControllerOffset,6,flash);
  sfr=new SFR(this,memory);
  ioSegment.setIORange(config.sfrOffset,0x10,sfr);
  Timer[] timers=new Timer[config.timerConfig.length];
  for (int i=0; i < config.timerConfig.length; i++) {
    Timer t=new Timer(this,memory,config.timerConfig[i]);
    ioSegment.setIORange(config.timerConfig[i].offset,0x20,t);
    ioSegment.setIORange(config.timerConfig[i].timerIVAddr,1,t);
    timers[i]=t;
  }
  bcs=config.createClockSystem(this,memory,timers);
  ioSegment.setIORange(bcs.getAddressRangeMin(),bcs.getAddressRangeMax() - bcs.getAddressRangeMin() + 1,bcs);
  ioUnits.add(sfr);
  ioUnits.add(bcs);
  config.setup(this,ioUnits);
  for (int i=0; i < timers.length; i++) {
    ioUnits.add(timers[i]);
  }
  watchdog=new Watchdog(this);
  ioSegment.setIORange(config.watchdogOffset,1,watchdog);
  ioUnits.add(watchdog);
  bcs.reset(0);
}