title: gdb watchpoint won't work when variable changes from going off end of array
body: <pre><code>#include &lt;stdio.h&gt;
  
  typedef struct ThingStruct {
      int arr[8];
      int after;
  } Thing;
  
  void foo(int i) {
      Thing thing;
      int* ip = &amp;thing.after;
      thing.after = 12345;
      printf("beforehand\n");
      thing.arr[i] = 55;
      printf("done\n");
  }
  
  int main() {
      foo(8);
  }
  </code></pre>
  
  <p>This code changes <code>thing.after</code> by accidentally going off the end of the array. I want to try to find the line where where <code>thing.after</code> is changing by using gdb. So I compile with -g , put a breakpoint on line 12, then put a watchpoint on <code>thing.after</code>, but the watchpoint doesn't trigger, even though putting a breakpoint on line 14 does show that <code>thing.after</code> did change.</p>
  
  <p>I even tried taking the address of <code>thing.after</code> and setting a watchpoint on that, but it still does not trigger.</p>