Thread overview
[Bug 79] New: Assertion failure: mtype.c 364 - using a forward-referenced alias of an undefined type
Apr 01, 2006
d-bugmail
Apr 02, 2006
Thomas Kuehne
May 14, 2006
d-bugmail
May 25, 2006
d-bugmail
April 01, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=79

           Summary: Assertion failure: mtype.c 364 - using a forward-
                    referenced alias of an undefined type
           Product: D
           Version: 0.150
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: smjg@iname.com


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


-- 

April 02, 2006
d-bugmail@puremagic.com 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.d http://dstress.kuehne.cn/nocompile/a/alias_33_B.d http://dstress.kuehne.cn/nocompile/a/alias_33_C.d http://dstress.kuehne.cn/nocompile/a/alias_33_D.d http://dstress.kuehne.cn/nocompile/t/typedef_14_A.d http://dstress.kuehne.cn/nocompile/t/typedef_14_B.d http://dstress.kuehne.cn/nocompile/t/typedef_14_C.d http://dstress.kuehne.cn/nocompile/t/typedef_14_D.d

Thomas


May 14, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=79


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #2 from bugzilla@digitalmars.com  2006-05-14 18:40 -------
Cannot duplicate with 0.157.


-- 

May 25, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=79


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED




------- Comment #3 from bugzilla@digitalmars.com  2006-05-25 04:18 -------
Fixed 0.158


--