<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - C personality function crashes on ARM EHABI"
   href="https://llvm.org/bugs/show_bug.cgi?id=26012">26012</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C personality function crashes on ARM EHABI
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tzuhsiang.chien@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If a C function contains a cleanup attribute and the source code is compiled
with -fexceptions, then __gcc_personality_v0() will be called by the unwinder.

However, our __gcc_personality_v0() implementation in compiler-rt is not
compatible with ARM EHABI.  Consequently, the mismatch of the function
signature will cause a segmentation fault.

$ cat cleanup.c
extern void my_throw();

int i = 0;

void callback(int *p) {
  i = 1;
}

void test_cleanup() {
  int a __attribute__((cleanup(callback))) = 1;
  my_throw();
}


$ gdb ./bad.out
... skipped ...
Program received signal SIGSEGV, Segmentation fault.
0xb6f6e910 in unw_get_proc_info () from /opt/llvm/lib/libunwind.so.1
(gdb) bt
#0  0xb6f6e910 in unw_get_proc_info () from /opt/llvm/lib/libunwind.so.1
#1  0xb6f73c70 in _Unwind_GetLanguageSpecificData ()
   from /opt/llvm/lib/libunwind.so.1
#2  0x000108fc in __gcc_personality_v0 ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)


NOTE: There is a patch (written by Timon Van Overveldt) in the review process
that can fix the problem:
<a href="http://reviews.llvm.org/D15781">http://reviews.llvm.org/D15781</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>