Skip to content

Long and memory-wasting debug symbols generation #139970

Open
@speshuric

Description

@speshuric

Steps to reproduce

  1. Save attached main.cpp.txt as cpp file (it is small - 1.7 KB, <100LOC)
  2. Compile it with debug information and O2/O3 optimizations. I use: clang++ main.cpp -g -O2
  3. Uncomment lines one by one and compile again

Expected

Compile is almost instant.

Actually

Compile time grows twice with every uncommented line. Memory usage exceeds 20GB with uncommented line with f24

Last uncommented line Compile time on my PC, seconds
f16 0.945
f17 1.627
f18 3.170
f19 6.121
f20 12.355
f21 25.471
f22 51.952
f23 1:46.11

Environment

$clang++ --version
clang version 19.1.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$uname -a
Linux 6.14.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 09 May 2025 17:36:18 +0000 x86_64 GNU/Linux

Despite I use clang installed as package from archlinux repos, the same issue observed on godbolt site with various clang versions and targets.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions