[llvm-bugs] [Bug 24648] -fvisibility=hidden and -fvisibility-inlines-hidden being ignored

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 1 16:29:41 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24648

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
If you want to define a structure for internal-only consumption, you need to
give it internal linkage (wrap it in an anonymous namespace). Otherwise, your
program is ill-formed (no diagnostic required) due to an ODR violation, which
leads to undefined behavior at runtime in this case.

The difference you're seeing here is unrelated to visibility -- that affects
DSO boundaries, and in this case you linked the two object files into the same
binary. The difference is simply that LLVM's inliner chose not to inline the
operator[] function. You'll probably see the same thing with the other
compilers if you turn off optimization (or maybe if you link the object files
in the opposite order).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150901/a0636b7d/attachment-0001.html>


More information about the llvm-bugs mailing list