[llvm-bugs] [Bug 49809] New: [[no_unique_address]] on array of class takes compilation time and memory linear in size of array

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 1 14:00:06 PDT 2021


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

            Bug ID: 49809
           Summary: [[no_unique_address]] on array of class takes
                    compilation time and memory linear in size of array
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: davidfromonline at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following translation unit

```
struct s {
        // Doesn't have to be empty
};

struct array {
        [[no_unique_address]] s m_value[1'000'000'000ULL];
};

void f() {
        array a;
}
```

eventually crashes with out of memory, but if it were to compile it would have
taken approximately 45 seconds on my machine with `clang++ -std=c++17 -c
test.cpp`. Based on the progression from smaller array sizes, making the array
10x larger would make it take about 450 seconds.

Just reproduced with latest commit

```
> clang++ --version
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
0f7e3a55463d2ed9abc60c6fd0126bcb19fc6d69)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/david/llvm/build/bin
```

-- 
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/20210401/ef50e0bf/attachment.html>


More information about the llvm-bugs mailing list