<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 --- - Flag unbalanced .cfi_adjust_cfa_offset directives at .cfi_endproc as error"
   href="https://llvm.org/bugs/show_bug.cgi?id=26098">26098</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Flag unbalanced .cfi_adjust_cfa_offset directives at .cfi_endproc as error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>gccas
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>bart.jacobs@cs.kuleuven.be
          </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>Created <span class=""><a href="attachment.cgi?id=15597" name="attach_15597" title="Small repro">attachment 15597</a> <a href="attachment.cgi?id=15597&action=edit" title="Small repro">[details]</a></span>
Small repro

First: I'm not sure whether I am using gccas or llvm-as. The command I use is
'clang -arch x86_64 -c -v myobj.s'.

This is about .cfi_xxx directives for emitting DWARF CFI (call frame
information) that enables debuggers to generate stack backtraces and
programming language runtimes (specifically C++ and Objective-C) to walk and
unwind the stack.

The assembler currently accepts input where the net CFA offset adjustment at a
.cfi_endproc is nonzero. See small example attached. Its current behavior in
that case is that the adjustment is applied to the next assembly routine
(.cfi_startproc directive) as well. You can see by running 'dwarfdump
--eh-frame myobj.o'. I believe this input is usually/always erroneous and
furthermore the behavior is undesirable.

I would suggest to at least offer an option to have this flagged as an error.
Also, that behavior should probably be the default.

(Context: the OCaml native code compiler currently generates such unbalanced
directives. See <a href="http://caml.inria.fr/mantis/view.php?id=7120">http://caml.inria.fr/mantis/view.php?id=7120</a> and
<a href="http://caml.inria.fr/mantis/view.php?id=7118">http://caml.inria.fr/mantis/view.php?id=7118</a> and
<a href="https://github.com/ocaml/ocaml/pull/408">https://github.com/ocaml/ocaml/pull/408</a> . In this case, it is definitely an
error. It caused my application to crash randomly. Especially during demos ;-)
)</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>