<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - incompatibility w/gcc re: ODR, template instantiation, optimization across translation units"
   href="https://llvm.org/bugs/show_bug.cgi?id=27853">bug 27853</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>richard-llvm@metafoo.co.uk
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - incompatibility w/gcc re: ODR, template instantiation, optimization across translation units"
   href="https://llvm.org/bugs/show_bug.cgi?id=27853#c20">Comment # 20</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - incompatibility w/gcc re: ODR, template instantiation, optimization across translation units"
   href="https://llvm.org/bugs/show_bug.cgi?id=27853">bug 27853</a>
              from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=27853#c19">comment #19</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=27853#c17">comment #17</a>)
> > Both compilers are probably discarding 'obj' because it is unused.

> But it *is* being used -- in doTest1 and doTest2.  So, I don't think that
> statement is correct.  </span >

It's unused *in the generated code*.

<span class="quote">> But I *thought* that statics (including local statics) were required to
> exist in the .bss section of the shared library/executable.</span >

Some symbols are required to be emitted by every translation unit that needs a
definition of them (after optimization). Those ones are not guaranteed to exist
anywhere in the optimized object code.

If you want to find symbols via dlsym, you need to avoid that kind. The usual
approach to this is to make the symbols external linkage, extern "C", and
marked with __attribute__((used)). That guarantees their existence and that
they have a non-mangled name.</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>