Bug 79 – Assertion failure: mtype.c 364 - using a forward-referenced alias of an undefined type
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-04-01T16:03:00Z
Last change time
2014-02-15T02:09:39Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
smjg
Comments
Comment #0 by smjg — 2006-04-01T16:03:50Z
If I forward-reference a type that is an alias of an undefined symbol, DMD crashes out.
----------
enum : LCTYPE {
LOCALE_ILANGUAGE,
}
alias DWORD LCTYPE;
----------
D:\My Documents\Programming\D\Tests\bugs\winnls.d(1): identifier 'DWORD' is not defined
Assertion failure: 't' on line 364 in file 'mtype.c'
----------
after which DMD hangs.
It appears to affect all uses of such an alias as a type, as long as the use precedes the alias declaration:
- declaring a variable or constant, whether at module, function or class/struct level
- declaring a typedef
- declaring an alias of the derived pointer or array type
- using as a function return type
- using as a function parameter
Comment #1 by thomas-dloop — 2006-04-02T07:00:27Z
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[email protected] schrieb am 2006-04-01:
> If I forward-reference a type that is an alias of an undefined symbol, DMD
> crashes out.
>
> ----------
> enum : LCTYPE {
> LOCALE_ILANGUAGE,
> }
>
> alias DWORD LCTYPE;
> ----------
> D:\My Documents\Programming\D\Tests\bugs\winnls.d(1): identifier 'DWORD' is not
> defined
> Assertion failure: 't' on line 364 in file 'mtype.c'
> ----------
>
> after which DMD hangs.
Doesn't hang on Linux, just asserts:
compile/a/alias_33_B.d(13): identifier 'UNDEFINED' is not defined
dmd: mtype.c:364: Type* Type::merge(): Assertion `t' failed.
Program received signal SIGABRT, Aborted.
0x5566ab81 in kill () from /lib32/libc.so.6
(gdb) bt
#0 0x5566ab81 in kill () from /lib32/libc.so.6
#1 0x5566a8f5 in raise () from /lib32/libc.so.6
#2 0x5566bd58 in abort () from /lib32/libc.so.6
#3 0x55663887 in __assert_fail () from /lib32/libc.so.6
#4 0x080c27a0 in Type::merge ()
#5 0x080c63ce in TypeQualified::resolveHelper ()
#6 0x080c6803 in TypeIdentifier::resolve ()
#7 0x080c69a8 in TypeIdentifier::semantic ()
#8 0x0808524f in VarDeclaration::semantic ()
#9 0x080c1688 in Module::semantic ()
#10 0x080bf1b7 in main ()
Added to DStress as
http://dstress.kuehne.cn/nocompile/a/alias_33_A.dhttp://dstress.kuehne.cn/nocompile/a/alias_33_B.dhttp://dstress.kuehne.cn/nocompile/a/alias_33_C.dhttp://dstress.kuehne.cn/nocompile/a/alias_33_D.dhttp://dstress.kuehne.cn/nocompile/t/typedef_14_A.dhttp://dstress.kuehne.cn/nocompile/t/typedef_14_B.dhttp://dstress.kuehne.cn/nocompile/t/typedef_14_C.dhttp://dstress.kuehne.cn/nocompile/t/typedef_14_D.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFEL7zQ3w+/yD4P9tIRAjUjAJwOyFf7QbBGbKCCenaye7MPQ/aGcACfcNWf
FQLNSMx+BTm7Zu6bvZ+Dre8=
=v2FJ
-----END PGP SIGNATURE-----