Thread overview
ICEs on package.d module names
May 10, 2017
Solomon E
May 10, 2017
Iain Buclaw
May 10, 2017
Iain Buclaw
May 30, 2017
Solomon E
May 10, 2017
I've got errors, and I wasn't sure about reporting them, because there are
so many, and they're probably all my fault, but some are ICEs.


file program.d:

import subdir.first_module;
import subdir: second_module;

void main() {
    assert(first_ok());
    assert(second_module.second_ok());
}


file subdir/package.d:

module subdira;

public import second_module;


file subdir/first_module.d:

bool first_ok()
{
    return true;
}


file subdir/second_module.d:

bool second_ok()
{
    return true;
}


$ gdc program.d -Isubdir subdir/first_module.d subdir/second_module.d
cc1d: ../../src/gcc/d/dfrontend/import.c:144: void Import::load(Scope*): Assertion `mod->isPackageFile == (p->isPkgMod == PKGmodule)' failed.
cc1d: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.

Then change the line in subdir/package.d "module subdira;" to "module subdir;"
That should fix it!

$ gdc program.d -Isubdir subdir/first_module.d subdir/second_module.d
program.d:1:8: internal compiler error: in visit, at d/imports.cc:47
 import subdir.first_module;
        ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.


I tried signing in at Bugzilla, which I've used before, but it didn't accept my password, and when I asked to reset my password, it said it sent an email, but I didn't receive an email. Maybe you're not using the same Bugzilla as some other project.
May 10, 2017
On 10 May 2017 at 05:11, Solomon E via D.gnu <d.gnu@puremagic.com> wrote:
> I've got errors, and I wasn't sure about reporting them, because there are so many, and they're probably all my fault, but some are ICEs.
>
>
> file program.d:
>
> import subdir.first_module;
> import subdir: second_module;
>

Importing an import.  That seems to be one case I forgot to cover.

>
> I tried signing in at Bugzilla, which I've used before, but it didn't accept my password, and when I asked to reset my password, it said it sent an email, but I didn't receive an email. Maybe you're not using the same Bugzilla as some other project.

Send me a private message, and I could sort that out for you.
May 10, 2017
On 10 May 2017 at 05:11, Solomon E via D.gnu <d.gnu@puremagic.com> wrote:
>
> $ gdc program.d -Isubdir subdir/first_module.d subdir/second_module.d
> cc1d: ../../src/gcc/d/dfrontend/import.c:144: void Import::load(Scope*):
> Assertion `mod->isPackageFile == (p->isPkgMod == PKGmodule)' failed.
> cc1d: internal compiler error: Aborted
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
>

I can't reproduce this, but is a front-end bug anyway, so should be reproducible in DMD too (if you compile it without -release).
May 30, 2017
On Wednesday, 10 May 2017 at 08:17:00 UTC, Iain Buclaw wrote:
> On 10 May 2017 at 05:11, Solomon E via D.gnu <d.gnu@puremagic.com> wrote:
>>
>> $ gdc program.d -Isubdir subdir/first_module.d subdir/second_module.d
>> cc1d: ../../src/gcc/d/dfrontend/import.c:144: void Import::load(Scope*):
>> Assertion `mod->isPackageFile == (p->isPkgMod == PKGmodule)' failed.
>> cc1d: internal compiler error: Aborted
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
>>
>
> I can't reproduce this, but is a front-end bug anyway, so should be reproducible in DMD too (if you compile it without -release).

Sorry I didn't reply about this in a timely manner. The gdc compiler versions that produced the assertion error were 2.068 and earlier. I had thought it was being fixed, because the code there changed within a few days of when I first found that assertion error. Then I waited for the upgrade to get to me. It's not a problem any more in dmd 2.074, which should mean it's fixed if it was a front end problem.

For the other error, about importing an import if that's what the problem was, I found that in gdc 2.068. It was a new error that hadn't seen before in experiments that used to work, in earlier gdc versions than 2.068, so I'm glad I was able to help find a current bug that you could fix.

Also, the gdc compiler has sometimes allowed importing a module qualified by a folder or package name, where the 2.074 dmd compiler gives an error on that sort of import, saying that the module must be imported as its own name. I don't know which is the way it really should be.

Those experiments I was doing were about different ways to build and use a personal D library or a folder that would be used like a library from different project folders. The way I decided was best for me was just to keep it simple, by making a folder with symlinks to the versions of my D source files that I want to use like a library. That way sometimes it's only necessary to mention that folder correctly after -I in the compile command line, instead of having to mention every file that's imported.

(Also that way I don't have to recompile a library .a file with a makefile for every code change and after every D compiler version update, which I found out does cause a failure to build if it's not recompiled.)