title: Gcc compiler C string assignment issue
body: <p>I wrote this code because I'm having a similar problem in a larger program I'm writing. For all I know the problem is the same so I made this small example.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  typedef struct
  {
      int x;
      char * val;
  }my_struct;
  
  int main()
  {
      my_struct me = {4, " "};
      puts("Initialization works.");
      me.val[0] = 'a';
      puts("Assignment works.");
      puts(me.val);
      puts("Output works.");
      return 0;
  }
  </code></pre>
  
  <p>When compiled with tcc (Tiny C Compiler) it compiles and executes fine. But using GCC 4.6.0 20110513 (prerelease) it compiles, however, when I execute it I only get past "Initialization works." before getting a segfault.</p>
  
  <p>What am I doing wrong? Is it my code or my GCC compiler?</p>