www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4529] New: dmd crash with writeln of functions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4529

           Summary: dmd crash with writeln of functions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



D2 code, compiled with dmd 2.047, causes a crash of the compiler:


import std.stdio;
void main() {
    string a();
    writeln(typeid(typeof(a)));
    string function() b;
    writeln(typeid(typeof(b)));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 28 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4529


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



19:03:02 PDT ---
This affects 2.048 too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 29 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4529




REDUCED TEST CASE:

int bug4529a() { return 0; }
int function() bug4529b;
auto ivorBomb1 = typeid(typeof(bug4529a));
auto ivorBomb2 = typeid(typeof(bug4529b));

Note that swapping the order of the two 

typinf.c, Type::getTypeInfo() line 152.
The crash is because vtinfo hasn't been initialized. And this happens because
we have a funny situation where vtinfo has been set up for the pointee (which
is a function), but not yet for the pointer (which is a pointer to a function). 

Possibly a more complete solution would be to disallow typeof(X) where X is a
function; if so, an assert(vtinfo) should still be added at this line.

------

                t->vtinfo->toObjFile(global.params.multiobj);
            }
        }
    }
+    if (!vtinfo)
+        vtinfo = t->vtinfo;
    Expression *e = new VarExp(0, t->vtinfo);
    e = e->addressOf(sc);
    e->type = t->vtinfo->type;          // do this so we don't get redundant
dereference
    return e;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 03 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4529


Walter Bright <bugzilla digitalmars.com> changed:

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



19:01:16 PST ---
http://www.dsource.org/projects/dmd/changeset/750

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