<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Compiler no longer generating debug info for inlined templated member function at -O2"
   href="https://llvm.org/bugs/show_bug.cgi?id=27975">27975</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler no longer generating debug info for inlined templated member function at -O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The compiler used to generate debug info for inlined templated member functions
when optimizations are enabled (-O2 or higher). However, with upstream change
r265876, the compiler no longer seems to generate this information and I
suspect it may be a bug introduced with that change.

To reproduce the bug, compile the following code with -O2 -g, and then examine
the dwarf output that is generated:

/**************/
int global_val = 0;

class Type1
{
public:
        void inlined() { global_val++; }
        template<int T> void templated() { global_val++; }
};

class Type2
{
public:
        void outofline();
        template<int T> void templated() { global_val++; }
};

void Type2::outofline() { global_val++; }

int main()
{
        Type1 t1;
        t1.inlined();
        t1.templated<0>();

        Type2 t2;
        t2.outofline();
        t2.templated<0>();

        return 0 == global_val;
}
/**************/

If the above code is compiled without optimizations (-O0 -g), you will find a
DW_TAG_subprogram block for templated<0> for both Type1 and Type2. If you
enable optimizations (-O2 -g for example), the debug info for templated<0> from
Type1 is no longer generated.

This issue exists with the current trunk, I am using a compiler built from
r271347 targeting x64 linux.</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>