title: Linaro g++ aarch64 compilation cause unalignment fault
body: <p>I'm using linaro g++ for ARM arch64 to compile a simple cpp file:</p>
  
  <pre><code>int main()
  {
      char  *helloMain      = "main module (crm.c)";
      long  faculty, num    = 12;
      int   stop,mainLoop   = 1; 
      char  word[80]        = "";
  }
  </code></pre>
  
  <p>After <code>objdump</code> the generated elf file, I got its asm code:</p>
  
  <pre><code>0000000000001270 &lt;main&gt;:
  int main()
  {
      1270:   d101c3ff    sub sp, sp, #0x70
      char  *helloMain      = "main module (crm.c)";
      1274:   90000020    adrp    x0, 5000 &lt;_malloc_trim_r+0x160&gt;
      1278:   9111c000    add x0, x0, #0x470
      127c:   f90003e0    str x0, [sp]
      long  faculty, num    = 12;
      1280:   d2800180    movz    x0, #0xc
      1284:   f90007e0    str x0, [sp,#8]
      int   stop,mainLoop   = 1; 
      1288:   52800020    movz    w0, #0x1
      128c:   b90013e0    str w0, [sp,#16]
      char  word[80]        = "";
      1290:   910063e0    add x0, sp, #0x18
      1294:   90000021    adrp    x1, 5000 &lt;_malloc_trim_r+0x160&gt;
      1298:   91122021    add x1, x1, #0x488
      129c:   39400021    ldrb    w1, [x1]
      12a0:   39000001    strb    w1, [x0]
      12a4:   91000400    add x0, x0, #0x1
      12a8:   a9007c1f    stp xzr, xzr, [x0]
      12ac:   a9017c1f    stp xzr, xzr, [x0,#16]
      12b0:   a9027c1f    stp xzr, xzr, [x0,#32]
      12b4:   a9037c1f    stp xzr, xzr, [x0,#48]
      12b8:   f900201f    str xzr, [x0,#64]
      12bc:   b900481f    str wzr, [x0,#72]
      12c0:   7900981f    strh    wzr, [x0,#76]
      12c4:   3901381f    strb    wzr, [x0,#78]
  }
      12c8:   52800000    movz    w0, #0x0
      12cc:   9101c3ff    add sp, sp, #0x70
      12d0:   d65f03c0    ret
  </code></pre>
  
  <p>Before executing this code on an ARMV8 board, <code>sp</code> is initialized to an address aligned to 0x1000. </p>
  
  <p>The execution of such code raised an alignment fault exception on 
          12a8:   a9007c1f    stp xzr, xzr, [x0]</p>
  
  <p>I noticed <code>x0</code> was added by <code>0x1</code> so it was aligned to <code>0x1</code> when <code>stp</code> instruction was executed.</p>
  
  <p>Why g++ didn't make it align to <code>0x10</code> to avoid such alignment fault exception?</p>
  
  <p>The g++ version is:</p>
  
  <pre><code>gcc  4.8.1 20130506 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.05 - Linaro GCC 2013.05)
  </code></pre>