www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - HELP! DMD Asserts while generating DI files.

reply "Adam Wilson" <flyboynw gmail.com> writes:
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/
Jan 22 2012
parent reply kenji hara <k.hara.pg gmail.com> writes:
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 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
 {
 =A0 =A0 =A0 =A0pure int bsf(size_t v);

 =A0 =A0 =A0 =A0pure int bsr(size_t v);

 =A0 =A0 =A0 =A0pure int bt(in size_t* p, size_t bitnum);

 =A0 =A0 =A0 =A0int btc(size_t* p, size_t bitnum);
 =A0 =A0 =A0 =A0int btr(size_t* p, size_t bitnum);
 =A0 =A0 =A0 =A0int bts(size_t* p, size_t bitnum);
 =A0 =A0 =A0 =A0pure uint bswap(uint v);

 =A0 =A0 =A0 =A0ubyte inp(uint port_address);
 =A0 =A0 =A0 =A0ushort inpw(uint port_address);
 =A0 =A0 =A0 =A0uint inpl(uint port_address);
 =A0 =A0 =A0 =A0ubyte outp(uint port_address, ubyte value);
 =A0 =A0 =A0 =A0ushort outpw(uint port_address, ushort value);
 =A0 =A0 =A0 =A0uint outpl(uint port_address, uint value);
 =A0 =A0 =A0 =A0int popcnt(uint x);
 =A0 =A0 =A0 =A0debug (UnitTest)
 =A0 =A0 =A0 =A0{
 =A0 =A0 =A0 =A0}
 =A0 =A0 =A0 =A0uint bitswap(uint x);
 =A0 =A0 =A0 =A0debug (UnitTest)
 =A0 =A0 =A0 =A0{
 =A0 =A0 =A0 =A0}
 }

 produces this assert in DMD: assert cast.c(2082) t1->ty =3D=3D 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/
Jan 26 2012
parent reply "Adam Wilson" <flyboynw gmail.com> writes:
On Thu, 26 Jan 2012 06:33:12 -0800, kenji hara <k.hara.pg 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 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/
Jan 26 2012
parent reply "Martin Nowak" <dawg dawgfoto.de> writes:
 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?
No it doesn't.
Jan 31 2012
parent reply "Adam Wilson" <flyboynw gmail.com> writes:
On Tue, 31 Jan 2012 18:20:13 -0800, Martin Nowak <dawg dawgfoto.de> wrote:

 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?
No it doesn't.
That makes this even weirder then, because the DI seems to generate itself just fine and the problems are all afterwards. Well, I've got an email out to Walter to see what he has to say on the subject. -- Adam Wilson Project Coordinator The Horizon Project http://www.thehorizonproject.org/
Jan 31 2012
parent "Martin Nowak" <dawg dawgfoto.de> writes:
On Wed, 01 Feb 2012 06:46:42 +0100, Adam Wilson <flyboynw gmail.com> wrote:

 On Tue, 31 Jan 2012 18:20:13 -0800, Martin Nowak <dawg dawgfoto.de>  
 wrote:

 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?
No it doesn't.
That makes this even weirder then, because the DI seems to generate itself just fine and the problems are all afterwards. Well, I've got an email out to Walter to see what he has to say on the subject.
This would be a lot simpler if you'd show us the modifications for DI gen.
Jan 31 2012