https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97783
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-11-11
Keywords| |wrong-code
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. It's IPA reference that does not appropriately make the "local"
function gl_lstat global when it escapes in main to glob().
For some reason it doesn't reproduce with the simple
TU1:
void foo(void (**fn)())
{
(*fn)();
}
TU2:
static int x;
static void bar() { x = 1; }
extern void foo(void (**)());
int
main ()
{
void (*ptr)() = bar;
x = 0;
foo(&ptr);
if (x != 1)
__builtin_abort ();
return 0;
}