<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 - constexpr variables in Lambda not known in Debug Info"
href="https://bugs.llvm.org/show_bug.cgi?id=47400">47400</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>constexpr variables in Lambda not known in Debug Info
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>enhancement
</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>melanie.blower@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Within the lambda body, nothing is known about the constexpr identifier
Small example:
#define MAX_N_STEPS 8192
int main() {
constexpr int n_steps = MAX_N_STEPS + 2;
auto F = [=](unsigned int param) {
for (short i = n_steps; i >= 0; --i)
param += i;
};
F(42);
return 0;
}
gcc does produce information about the identifier, tho' the value is not
available (optimized out)
(gdb) b 6
Breakpoint 1 at 0x40111a: file test.cpp, line 6.
(gdb) r
Starting program: a.out.g++
Breakpoint 1, <lambda(unsigned int)>::operator()(unsigned int) const (
__closure=0x7fffffff96eb, param=42) at test.cpp:6
6 param += i;
(gdb) whatis n_steps
type = const int
However, if you build with clang the identifier isn't available
(gdb) whatis n_steps
No symbol "n_steps" in current context.
Debugger engineer at Intel recommended that the debug info could be emitted as
if the test program were written this way:
#define MAX_N_STEPS 8192
class lambda {
private:
static constexpr int n_steps = MAX_N_STEPS + 2;
public:
void operator() (unsigned int param) {
for (short i = n_steps; i >= 0; --i)
param += i;
}
};
int main() {
constexpr int n_steps = MAX_N_STEPS + 2;
lambda F;
F(42);
return 0;
}
My colleague at Intel Mike Rice wrote up an exploratory patch, I will link it
to this bug report. Hoping to get some feedback from debug info experts.
Thanks and regards --Melanie Blower</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>