[llvm-bugs] [Bug 44253] New: Exhaustive stack usage

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 9 00:25:06 PST 2019


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

            Bug ID: 44253
           Summary: Exhaustive stack usage
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: antoshkka at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Consider the following example:

struct test {
    test(test&&);

    void Extend(test v);
    int data_[4096];
};


test test_func(test t) {
    t.Extend(static_cast<test&&>(t));
    t.Extend(static_cast<test&&>(t));
    return t;
}

With `-std=c++11 -O2` flags Clang uses 32768 bytes of stack, GCC uses 16392
bytes.

Note that adding additional `t.Extend(static_cast<test&&>(t));` results in
stack usage growth for Clang, while GCC keeps using only 16392 bytes.

Godbolt playground: https://godbolt.org/z/MdaNfa

-- 
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/20191209/da644775/attachment.html>


More information about the llvm-bugs mailing list