We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
We ran into a related problem with duplicate function entries in the CFG tables on Windows, see r301040. Perhaps we should enable that code always?
Sorry, something went wrong.
Sounds reasonable to me. We could avoid emitting the noop in functions with the unnamed_addr attribute, but it doesn't seem worth it to me.
Still reproduces as of post-17 trunk: https://godbolt.org/z/Gj8x7oj1M
This feels related to: #48943
Worth noting gcc does the same opt: https://godbolt.org/z/MazzcYb1T
Successfully merging a pull request may close this issue.
Extended Description
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
$ clang -Os addr-taken.c
$ ./a.out
0x400510 0x400510
The text was updated successfully, but these errors were encountered: