[lldb-dev] [Bug 24198] New: template enum parameter incorrectly mangled during expression evaluation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 21 07:29:33 PDT 2015


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

            Bug ID: 24198
           Summary: template enum parameter incorrectly mangled during
                    expression evaluation
           Product: lldb
           Version: 3.6
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: erik.olofsson at hansoft.se
    Classification: Unclassified

The following code:

enum ETest
{
    ETest_1 = 1
};

template <ETest t_Value>
struct TCTest
{
    static ETest ms_Value;
};

template <ETest t_Value>
ETest TCTest<t_Value>::ms_Value = t_Value;

int main()
{
    TCTest<ETest_1> ToTest;
    &TCTest<ETest_1>::ms_Value;
    return 0;
}

Compiled with:
clang++ -O0 -g Test.cpp

Debugged:
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) break set -l 16
Breakpoint 1: where = a.out`main + 13 at Test.cpp:19, address =
0x0000000100000f9d
(lldb) run
Process 60361 launched: '/Source/LLDBBugs/a.out' (x86_64)
Process 60361 stopped
* thread #1: tid = 0x8ec778, 0x0000000100000f9d a.out`main + 13 at Test.cpp:19,
queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f9d a.out`main + 13 at Test.cpp:19
   16      {
   17          TCTest<ETest_1> ToTest;
   18          &TCTest<ETest_1>::ms_Value;
-> 19          return 0;
   20      }
(lldb) expr ToTest.ms_Value
Internal error [IRForTarget]: Couldn't rewrite external variable
_ZN6TCTestI5ETestE8ms_ValueE
error: 0 errors parsing expression
error: The expression could not be prepared to run in the target

It seems that the enum template parameter is the problem. It should be looking
for 
_ZN6TCTestIL5ETest1EE8ms_ValueE

but is looking for:
_ZN6TCTestI5ETestE8ms_ValueE

If you change the template parameter to be an int instead of an enum type it
works.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150721/090c20df/attachment.html>


More information about the lldb-dev mailing list