https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107535

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> kind-of a pilot error,

Yes, this seems to be exactly what the code asks for. If you compile the class
with hidden visibility, its static member isn't shared between libfoo.so and
the rest of the program.

I think this fixes it:
struct __attribute__ ((visibility ("default"))) Foo {static inline int s = 100;
};

> maybe we should diagnose those cases instead?

So warn that DumpLibFoo has global visibility but refers to a global variable
that's potentially reachable from outside the current library, but that the
global variable's visibility doesn't match? Or something else?

Reply via email to