| Issue |
75968
|
| Summary |
LTO doesn't remove self-referential arrays
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
cwedgwood
|
Tested with clang-16 and `main`
Self referential arrays which are unreachable are not removed when using `-flto`, for example `clang -flto -Os unreachable.cc`:
~~~c++
// unreachable.cc
#include <stdio.h>
unsigned char unreachable[] = {1, 2, 3, 4, (unsigned char)((unsigned long)unreachable & 0xff)};
int main() {
printf("here\n");
return 0;
}
~~~
results in:
~~~shell
$ nm a.out |grep unreach
0000000000001050 t _GLOBAL__sub_I_unreachable.cc
000000000000401c b unreachable
~~~
Removing the last array element works as expected.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs