<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - -fvisibility-inlines-hidden marks static local variables as hidden when it shouldn't"
   href="https://bugs.llvm.org/show_bug.cgi?id=37595">37595</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-fvisibility-inlines-hidden marks static local variables as hidden when it shouldn't
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>redbeard0531@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>At the very least this is a scary undocumented difference from that flag's
meaning under gcc. Quoting the gcc man page for that flag (emphasis mine): The
behavior of this switch is not quite the same as marking the methods as hidden
directly, because ***it does not affect static variables local to the
function*** or cause the compiler to deduce that the function is defined in
only one shared object.

<a href="https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fvisibility-inlines-hidden">https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fvisibility-inlines-hidden</a>
only says "Give inline C++ member functions default visibility by default"
which doesn't seem to accurately describe the behavior.

Here is a simple example that shows the issue: <a href="https://godbolt.org/g/63FiwD">https://godbolt.org/g/63FiwD</a> 

inline int* test() {
    static int staticVar;
    return &staticVar;
}
auto force = test();

The problematic line is in the generated ASM is ".hidden test()::staticVar".
That is only generated with clang with -fvisibility-inlines-hidden. gcc does
not add that line to the output. I walked back the versions on godbolt and it
looks like this was introduced between 3.1 and 3.2.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>