| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
May 11, 2005 DMD 0.122: Cross-module multiply nested template instantiation with inline function from inside function causes compiler crash | ||||
|---|---|---|---|---|
| ||||
This requires two modules.
[a.d]
struct TC(T)
{
void method()
{
void inline_function()
{
}
}
}
template TB(T)
{
alias TC!(T) tc_instance;
}
struct TA(T)
{
mixin TB!(T);
}
[b.d]
import a;
void main()
{
TA!(int) variable;
}
Attempting to compile this causes the compiler to do an access violation; it should be acceptable code. The following are variants known to cause the problem to disappear. First variant, to remove the inline function:
[a.d]
struct TC(T)
{
void method()
{
-- void inline_function()
-- {
-- }
}
}
template TB(T)
{
alias TC!(T) tc_instance;
}
struct TA(T)
{
mixin TB!(T);
}
[b.d]
import a;
void main()
{
TA!(int) variable;
}
Second variant, to remove an abstraction stage:
[a.d]
struct TC(T)
{
void method()
{
void inline_function()
{
}
}
}
-- template TB(T)
-- {
-- alias TC!(T) tc_instance;
-- }
struct TA(T)
{
-- mixin TB!(T);
++ alias TC!(T) tc_instance;
}
[b.d]
import a;
void main()
{
TA!(int) variable;
}
Third variant, instantiate the template outside of the "main" function:
[a.d]
struct TC(T)
{
void method()
{
void inline_function()
{
}
}
}
template TB(T)
{
alias TC!(T) tc_instance;
}
struct TA(T)
{
mixin TB!(T);
}
[b.d]
import a;
++ alias TA!(int) TA_int;
void main()
{
-- TA!(int) variable;
++ TA_int variable;
}
| ||||
May 19, 2005 Re: DMD 0.122: Cross-module multiply nested template instantiation with inline function from inside function causes compiler crash | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | I couldn't reproduce the fault, but I put it in the test suite anyway. | |||
May 19, 2005 Re: DMD 0.122: Cross-module multiply nested template instantiation with inline function from inside function causes compiler crash | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Walter schrieb am Wed, 18 May 2005 22:52:41 -0700: > I couldn't reproduce the fault, but I put it in the test suite anyway. > > (gdb) run -v a.d b.d Starting program: dmd-0.123 -v a.d b.d parse a parse b semantic a semantic b semantic2 a semantic2 b semantic3 a semantic3 b code a generating code for function 'method' Program received signal SIGSEGV, Segmentation fault. 0x080a9d16 in FuncDeclaration::toObjFile() () (gdb) bt #0 0x080a9d16 in FuncDeclaration::toObjFile() () #1 0x080aa192 in FuncDeclaration::toObjFile() () #2 0x080e358e in StructDeclaration::toObjFile() () #3 0x080dadfa in TemplateInstance::toObjFile() () #4 0x080a9ce9 in Module::genobjfile() () #5 0x080b814b in main () Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCjFR+3w+/yD4P9tIRAkN6AKCvNyVgjHJdpne+ldeqzCueVM2uLwCeKLP0 37AVAbol2yLhZm4Ssim9GTI= =r3O2 -----END PGP SIGNATURE----- | |||
May 19, 2005 Re: DMD 0.122: Cross-module multiply nested template instantiation with inline function from inside function causes compiler crash | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | "Thomas Kuehne" <thomas-dloop@kuehne.this-is.spam.cn> wrote in message news:d8ol3u.43o.thomas-dloop@laermschleuder.kuehne.cn... > Program received signal SIGSEGV, Segmentation fault. Doesn't happen for me, either on windows or linux. | |||
May 19, 2005 Re: DMD 0.122: Cross-module multiply nested template instantiation with inline function from inside function causes compiler crash | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Walter schrieb am Thu, 19 May 2005 14:46:00 -0700: > > "Thomas Kuehne" <thomas-dloop@kuehne.this-is.spam.cn> wrote in message news:d8ol3u.43o.thomas-dloop@laermschleuder.kuehne.cn... >> Program received signal SIGSEGV, Segmentation fault. > > Doesn't happen for me, either on windows or linux. > The files are http://dstress.kuehne.cn/run/b/bug_20050510_A2.d http://dstress.kuehne.cn/compile/b/bug_20050510_A1.d no bug: dmd run/b/bug_20050510_A2.d compile/b/bug_20050510_A1.d bug: dmd compile/b/bug_20050510_A1.d run/b/bug_20050510_A2.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCjS6v3w+/yD4P9tIRAmIrAJ9qgxh72kss+rOMpjjVdorC0AgiBgCeML3L Akf2qcyY9dE5wEHstM+mx7w= =tNEF -----END PGP SIGNATURE----- | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply