HELP! DMD Asserts while generating DI files.

Adam Wilson flyboynw at gmail.com
Thu Jan 26 09:02:24 PST 2012


On Thu, 26 Jan 2012 06:33:12 -0800, kenji hara <k.hara.pg at gmail.com> wrote:

> What version do you use?
> In 2.058head(commit f8887855), `dmd -H -c test.d` succeeds to compile
> without DMD assertion.
>
> Kenji Hara
>
> 2012/1/23 Adam Wilson <flyboynw at gmail.com>:
>> Does anyone have any idea why DMD would assert with the following  
>> assert on
>> this code while building the druntime during DI generation?
>>
>> Generating This DI file...
>> // D import file generated from 'src\core\bitop.d'
>> module core.bitop;
>> nothrow
>> {
>>        pure int bsf(size_t v);
>>
>>        pure int bsr(size_t v);
>>
>>        pure int bt(in size_t* p, size_t bitnum);
>>
>>        int btc(size_t* p, size_t bitnum);
>>        int btr(size_t* p, size_t bitnum);
>>        int bts(size_t* p, size_t bitnum);
>>        pure uint bswap(uint v);
>>
>>        ubyte inp(uint port_address);
>>        ushort inpw(uint port_address);
>>        uint inpl(uint port_address);
>>        ubyte outp(uint port_address, ubyte value);
>>        ushort outpw(uint port_address, ushort value);
>>        uint outpl(uint port_address, uint value);
>>        int popcnt(uint x);
>>        debug (UnitTest)
>>        {
>>        }
>>        uint bitswap(uint x);
>>        debug (UnitTest)
>>        {
>>        }
>> }
>>
>> produces this assert in DMD: assert cast.c(2082) t1->ty == t2->ty
>> which appears to be the typeMerge function in cast.c
>>
>> It doesn't do this on all DI files and I am at a loss as to any rhyme or
>> reason for when it does assert. Perhaps someone with knowledge of the
>> compiler internals could be of help...
>>
>> Any ideas would be very helpful!
>>
>> --
>> Adam Wilson
>> Project Coordinator
>> The Horizon Project
>> http://www.thehorizonproject.org/

Hi Kenji,

It appears to be a problem related to my DI generation patch. But I don't  
know near enough about cast.c to reduce the problem quickly, my guess is  
that druntime and phobos are excepting something to exist in the DI that  
the patch strips out, but that's only a guess. As you can see, the DI file  
itself is generated without any errors, this assert seems to come  
afterwards. Does D export the .DI file then try to use it during  
compilation of the .D file?

-- 
Adam Wilson
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


More information about the Digitalmars-d mailing list