[Bug target/126628] dllimport-ed PMF has invalid address in initializer_list

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 04:38:21 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126628

--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
>gcc-15 seems to have a regression in the way how PMF are populated inside =
an initializer_list when the PMF function is dllimport: afaict the initiali=
zer_list will populate the pointers before the dll resolution occurs

There was a change in GCC 15 to make initializer_list array constant (read
only). This sounds like the wrong section is being used for constant arrays=
 of
(dll_import) function pointers in general.=20=20


Does it happen if you simple things like:
typedef void (*fp)(void);
const fp array[] =3D {func1, func2, func3};

[[gnu::noipa]]
const fp *g()
{
  return array;
}

And then use g() ?=