[llvm-bugs] [Bug 41973] New: Computed goto and -ftest-coverage -fprofile-arcs causes segfault.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 21 15:45:31 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41973

            Bug ID: 41973
           Summary: Computed goto and -ftest-coverage -fprofile-arcs
                    causes segfault.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: bmoses at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190521/b94afdbd/attachment.html>


More information about the llvm-bugs mailing list