[llvm-bugs] [Bug 33033] New: Clang should never emit zero-length functions if they may be address-taken

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 14 17:21:24 PDT 2017


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

            Bug ID: 33033
           Summary: Clang should never emit zero-length functions if they
                    may be address-taken
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: peter at pcc.me.uk
                CC: llvm-bugs at lists.llvm.org

If the linker places a zero-length function at the same address as another
function, function pointer equality may be broken.

$ cat addr-taken.c 
#include <stdio.h>
void f1() { __builtin_unreachable(); }
void f2() { __builtin_unreachable(); }
int main() {
  printf("%p %p\n", &f1, &f2);
}
$ clang -Os addr-taken.c
$ ./a.out 
0x400510 0x400510

-- 
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/20170515/3f4cff02/attachment.html>


More information about the llvm-bugs mailing list