www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4242] New: ICE(module.c): module naming conflict in subfolder

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

           Summary: ICE(module.c): module naming conflict in subfolder
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2010-05-27 15:06:39 PDT ---
Reported by Matthias.
-----
The dmd compiler v2.046 produces correct output ("Error: module test from file
xxx.d conflicts with another module test from file yyy.d"), if multiple
placement of same module identifier are in the root of the project, however it
crashes, when the files are in a subfolder and does not display a proper error
message.

The output is:
Assertion failure: 'mprev' on line 641 in file 'module.c'

Test case:
--main.d--
import std.stdio;

import folder.File1;
import folder.File2;

int main(char[][] args)
{
    writefln(file2);
    return 0;
}

--folder\File1.d--
module folder;

const char[] file1 = "File1";

--folder\File2.d--
module folder;

const char[] file2 = "File2";

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|ICE(module.c): module       |ICE(module.c): importing a
                   |naming conflict in          |module with same name as
                   |subfolder                   |package
           Severity|normal                      |regression


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-05-27 22:53:49 PDT ---
This is a regression since DMD2.043. Only a single import is required (don't
need File2 in the test case).

PATCH:

Index: module.c
===================================================================
--- module.c    (revision 502)
+++ module.c    (working copy)
   -638,9 +638,16   
         Dsymbol *prev = dst->lookup(ident);
         assert(prev);
         Module *mprev = prev->isModule();
-        assert(mprev);
-        error(loc, "from file %s conflicts with another module %s from file
%s",
-            srcname, mprev->toChars(), mprev->srcfile->toChars());
+        if (mprev)
+            error(loc, "from file %s conflicts with another module %s from
file %s",
+                srcname, mprev->toChars(), mprev->srcfile->toChars());
+        else
+        {
+            Package *pkg = prev->isPackage();
+            assert(pkg);
+            error(loc, "from file %s conflicts with package name %s ",
+                srcname, pkg->toChars());
+        }
     }
     else
     {

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-05-28
22:32:38 PDT ---
http://www.dsource.org/projects/dmd/changeset/504

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