https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97771
--- Comment #7 from Erez Strauss ---
Hi Andrew,
Here is a very simple test program, under clang++ its output is 3, as expected.
Its output is 2 in case of g++ 11.2.1 20210728 (Red Hat 11.2.1-1)
#include
static int X;
typedef void (*funcP)();
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97771
--- Comment #5 from Erez Strauss ---
Yes, thanks, the asm() works - but if it can be expressed in C++, why add the
dependency on assembly?
1. attribute constructor - fails to compile
2. placing the address into the .init_array fails to generate
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97771
--- Comment #2 from Erez Strauss ---
Thanks, I tried, it fails with:
$ g++ -O2 -std=c++20 init_array5c.cpp -o init_array5c
init_array5c.cpp: In function ‘void localFunc(const char*)’:
init_array5c.cpp:17:55: warning: ‘constructor’ attribute igno
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97771
Bug ID: 97771
Summary: gcc/g++ failed to generate proper .init_array entries
for local scope function, should create "axG",
.init_array comdat
Product: gcc
Versio