[llvm-bugs] [Bug 41667] New: Clang needs to truncate templated class names in crash reports

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 29 16:42:17 PDT 2019


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

            Bug ID: 41667
           Summary: Clang needs to truncate templated class names in crash
                    reports
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code of recursive template instantiations exceeds the default
instantiation limit and runs out of memory.  This is pretty standard, but when
the crash report is printed, it will print every templated type expanded out. 
The code is only 6 lines long and the crash report is only 48 lines long, but
the full crash report is over 500 MB of text.  Some kind of limit on the line
length is needed to keep the crash report under a reasonable size.

$ cat long_test.ii
template <class, class>
struct a;
template <class b, class c, class d = b>
class e : e<a<b, c>, d> {};
e<long, long> f;

$ clang long_test.ii
long_test.ii:4:11: fatal error: recursive template instantiation exceeded
maximum depth of 1024
class e : e<a<b, c>, d> {};
          ^~~~~~~~~~~~~
LLVM ERROR: out of memory
Stack dump:
0.      Program arguments: /usr/local/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name long_test.ii
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/lib/clang/9.0.0 -fdeprecated-macro -fdebug-compilation-dir
/usr/local/crash -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
/tmp/long_test-8f6e8f.o -x c++-cpp-output long_test.ii -faddrsig 
1.      long_test.ii:5:16: current parser token ';'
2.      long_test.ii:4:7: instantiating class definition 'e<long, long, long>'
3.      long_test.ii:4:7: instantiating class definition 'e<a<long, long>,
long, a<long, long> >'
4.      long_test.ii:4:7: instantiating class definition 'e<a<a<long, long>,
long>, a<long, long>, a<a<long, long>, long> >'
5.      long_test.ii:4:7: instantiating class definition 'e<a<a<a<long, long>,
long>, a<long, long> >, a<a<long, long>, long>, a<a<a<long, long>, long>,
a<long, long> > >'
6.      long_test.ii:4:7: instantiating class definition 'e<a<a<a<a<long,
long>, long>, a<long, long> >, a<a<long, long>, long> >, a<a<a<long, long>,
long>, a<long, long> >, a<a<a<a<long, long>, long>, a<long, long> >, a<a<long,
long>, long> > >'
...
  Lines get longer and longer
...
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (trunk 359392)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
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/20190429/a06b84f1/attachment.html>


More information about the llvm-bugs mailing list