[Issue 4481] New: Internal compiler error (glue.c, !vthis->csym) or compiles, depending on the import statements order

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 17 14:51:42 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4481

           Summary: Internal compiler error (glue.c,!vthis->csym) or
                    compiles, depending on the import statements order
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dmitry.olsh at gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2010-07-17 14:51:38 PDT ---
In some specific circumstances DMD 2.047 segfaults or not segfaults depending
on the order of imported modules. 
The message produced in case of the :
Assertion failure: '!vthis->csym' on line 694 in file 'glue.c'

ATM the reliable set of conditions on which I can reproduce this are:
- at least 2 modules (all source dumped in one file avoids this issue)
- both import std.algorithm (though I still belive it has little to do with it)
- one module defines class which then uses std.reduce 
- another one imports it *and* std.algorithm in a specific order.

Well, it looks like it's very subtle - one slight change and it no longer
manifests. Took almost one day to cut it down to a resonable size. 

//---------------- The test case ----------------
import std.algorithm;//move  this import statement after the next one or just
comment, and everything compiles 
import g;

void main(){}

///g.d
module g;
import std.algorithm;

class Font{// rewriting all of the functions below as free functions and it
again compiles
public:
   int charHeight(dchar c){ return 0; }
   int textHeight(in string text){
     auto maxHeight = (int h,dchar ch){ return max(h,charHeight(ch)); };
     return reduce!(maxHeight)(text);
   }
}

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


More information about the Digitalmars-d-bugs mailing list