<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 - std::map operator< stack frame size consumption"
   href="https://bugs.llvm.org/show_bug.cgi?id=34188">34188</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::map operator< stack frame size consumption
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lebedev.ri@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This could be either expected, or be a libcxx implementation defect, or clang
missing optimization, or any combination of those.

Reduced testcase:

#include <map>
#include <memory>
#include <string>
struct a;
struct b
{
  std::string c;
  std::string f;
  std::string d;
  int operator<(b e) const
  {
    return tie(c, f, d) < tie(c, f, e.d);
  }
};
struct j
{
  std::map<b, std::unique_ptr<a> > cameras;
  const a *g(const std::string &, const std::string &, const std::string &)
const;
};
using std::string;
inline b h(string, string, string)
{
  b i;
  return i;
}
const a *j::g(const string &c, const string &f, const string &d) const
{
  auto camera = cameras.find(h(0, 0, 0));
  return camera->second.get();
}


Compilation flags: -std=c++14 -c -Wframe-larger-than=0 cxx.cpp
Here is a comparison of stack frame size usage in function 'b::operator<':

/ --------------------------\
|======| libcxx | libstdc++ |
| -O3  |  n/a   |    n/a    |
| -O2  |  n/a   |    n/a    |
| -O1  |  72b   |    88b    |
| -O0  |  4840b |    88b    |
| noop |  4840b |    88b    |
\---------------------------/

The measurements were made with clang tip, libcxx tip (compiled in release
build mode, no sanitizations)</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>