Bug 7634 – optlink creates bad debug info for a large number of modules
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
tools
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-03-03T04:03:00Z
Last change time
2017-01-10T01:44:13Z
Keywords
Optlink, pull, wrong-code
Assigned to
nobody
Creator
r.sagitario
Comments
Comment #0 by r.sagitario — 2012-03-03T04:03:43Z
Here's some code to generate 4000 functions:
import std.stdio;
import std.typetuple;
template countTuple(int n)
{
static if (n > 0)
alias TypeTuple!(countTuple!(n - 1), n - 1) countTuple;
else
alias TypeTuple!() countTuple;
}
void func(int i, int j)()
{
writeln(i, j);
}
void fun()
{
foreach(i; countTuple!(40))
foreach(j; countTuple!(100))
func!(i, j)();
}
When compiling it to a library with debug information:
>dmd -g -lib test.d
And linking it with a simple main.d:
import test;
void main()
{
fun();
}
>dmd -g main.d test.lib
the linker generates bad sstModule information for modules #2730, #4095, #6826,..., e.g.
Module #2730 (0074CB64)
SubSection: 0000 (<undefined>)
iMod: 0
lfo: 76412
cb: 25
unsupported type 0
Module #2731 (0074CB70)
SubSection: 0120 (sstModule)
iMod: 2731
lfo: 76440
The module numbers seem fixed, they also appear in completely different code.
BTW: if you increase the numbers of functions to 10000, optlink crashes. Maybe some of the other reported crashes are related.