<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Computed goto and -ftest-coverage -fprofile-arcs causes segfault."
   href="https://bugs.llvm.org/show_bug.cgi?id=41973">41973</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Computed goto and -ftest-coverage -fprofile-arcs causes segfault.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>bmoses@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>It looks like the combination of computed goto and -ftest-coverage
-fprofile-arcs is causing segfaults in the compiled code, starting with r359906
(and then the issue went away when r359906 was rolled back as r359912, and
returned when it was rolled forward again as r359919).

My suspicion is that r359906 is not at fault, but is simply exposing an
existing issue in the coverage code.  (I base this suspicion on the fact that
r359906 exposed a number of bugs elsewhere in our own codebase.)

This can be reproduced with this small example:

----
int main(int argc, char *argv[]) {
  void* ops[2] = {&&DISP_TWO, &&DISP_DONE};
  void** op = ops;

  goto **op;

DISP_DONE:
  goto out;

DISP_TWO:
  goto **(++op);

out:
  return 0;
}
----

This works when compiled normally, but segfaults when built with
-ftest-coverage -fprofile-arcs, in assembly assigned to the line with the
DISP_TWO label.</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>