Bug 13951 – Massive amounts of bloat generated for asserts by template.c
Status
RESOLVED
Resolution
REMIND
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-08T04:09:00Z
Last change time
2022-12-16T14:02:24Z
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2015-01-08T04:09:00Z
The dmd source code in template.c:
-------------------------------------------------------
void TemplateDeclaration::semantic(Scope *sc)
{
[...]
if (Module *m = sc->module) // should use getModule() instead?
{
// Generate these functions as they may be used
// when template is instantiated in other modules
// even if assertions or bounds checking are disabled in this module
m->toModuleArray();
m->toModuleAssert(); <=============
m->toModuleUnittest();
}
---------------------------------------------------
This results in huge numbers of assert() functions to be generated, each with its own copy of the source file name string. The assert() function is generated as a COMDAT, which removes duplicates, but the filename strings are not put in COMDATs and are duplicated innumerable times.
Comment #1 by dlang-bugzilla — 2017-07-21T10:49:59Z