Thread overview
[Issue 7859] New: Crash on invalid alias template parameter type
Apr 08, 2012
klickverbot
Apr 08, 2012
Walter Bright
Apr 09, 2012
Kenji Hara
April 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7859

           Summary: Crash on invalid alias template parameter type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: code@klickverbot.at


--- Comment #0 from klickverbot <code@klickverbot.at> 2012-04-08 11:59:45 PDT ---
Consider the following (invalid) snippet:
---
template A(alias B) {}

mixin template C(alias B = cast(NonExistent)null) {
  alias A!B D;
}

mixin C!();
---

DMD 2.058 just gave an error message, DMD 2.059 Git (5e7362a) prints the error message as well, but then crashes:
---
(gdb) r
test.d(3): Error: undefined identifier NonExistent

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00007fff83eb04f0 in strlen ()
(gdb) bt
#0  0x00007fff83eb04f0 in strlen ()
#1  0x00000001001a76d8 in OutBuffer::writestring (this=0x7fff5fbfef18,
string=0x0) at root.c:1603
#2  0x00000001001d7b3a in TemplateInstance::genIdent (this=0x100580160,
args=0x100580260) at template.c:5401
#3  0x00000001001e55c5 in TemplateInstance::semantic (this=0x100580160,
sc=0x100580be0, fargs=0x0) at template.c:4585
#4  0x00000001001d42c7 in TemplateInstance::semantic (this=0x100580160,
sc=0x100580be0) at template.c:4323
#5  0x0000000100170519 in TypeInstance::resolve (this=0x100580340,
loc={filename = 0x10051d470 "test.d", linnum = 4}, sc=0x100580be0,
pe=0x7fff5fbff248, pt=0x7fff5fbff250, ps=0x7fff5fbff240) at mtype.c:6693
#6  0x0000000100170479 in TypeInstance::toDsymbol (this=0x100580340,
sc=0x100580be0) at mtype.c:6748
#7  0x0000000100089b0d in AliasDeclaration::semantic (this=0x1005803f0,
sc=0x100580be0) at declaration.c:461
#8  0x00000001001d5639 in TemplateMixin::semantic (this=0x10051dfa0,
sc=0x10051e280) at template.c:6112
#9  0x0000000100155667 in Module::semantic (this=0x10051d260) at module.c:806
#10 0x0000000100152da9 in tryMain (argc=5, argv=0x100514180) at mars.c:1287
#11 0x0000000100153837 in main (argc=2, argv=0x7fff5fbffb50) at mars.c:1476
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7859



--- Comment #1 from github-bugzilla@puremagic.com 2012-04-08 12:56:43 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/53f0c9bc2308afe7cd360a28a2cee0f11e388f31 fix Issue 7859 - Crash on invalid alias template parameter type

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7859


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7859


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siegelords_abode@yahoo.com


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-08 17:53:55 PDT ---
*** Issue 7860 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------