[llvm-bugs] [Bug 27975] New: Compiler no longer generating debug info for inlined templated member function at -O2

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 1 16:46:20 PDT 2016


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

            Bug ID: 27975
           Summary: Compiler no longer generating debug info for inlined
                    templated member function at -O2
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
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/20160601/8e121f5f/attachment.html>


More information about the llvm-bugs mailing list