View mode: basic / threaded / horizontal-split · Log in · Help
February 19, 2012
Howto build a repo case for a ICE?
The last dmd version I could use to actually build my project was dmd 
2.056. Now I want to help finding those bugs that keep me from compiling 
and I'm wondering how I can build repro cases for the ICEs I encounter. 
I tried compiling with -v but that does not really give much information 
about where the crash actually happens. So I wonder what can actually be 
done to find the part of the code or even only the module it crashes in?

The current ICE I'm encountering is:
Assertion failure: 't1->ty == t2->ty' on line 2082 in file 'cast.c'

Kind Regards
Benjamin Thaut
February 19, 2012
Re: Howto build a repo case for a ICE?
There are only a few options:

- Reduce your code using dustmite.  I've never tried this, but I hear it 
works.
- Use a debug version of dmd, or post the code and hope someone else debugs 
it.
- Reduce the code manually.

The error you're getting occurs when merging two integral types together, 
and something goes horribly wrong.  It shouldn't be happening, but I'd guess 
it's something to do with alias this with integral types (huge guess).  How 
big is the project?

"Benjamin Thaut" <code@benjamin-thaut.de> wrote in message 
news:jhqt5p$1uel$1@digitalmars.com...
> The last dmd version I could use to actually build my project was dmd 
> 2.056. Now I want to help finding those bugs that keep me from compiling 
> and I'm wondering how I can build repro cases for the ICEs I encounter. I 
> tried compiling with -v but that does not really give much information 
> about where the crash actually happens. So I wonder what can actually be 
> done to find the part of the code or even only the module it crashes in?
>
> The current ICE I'm encountering is:
> Assertion failure: 't1->ty == t2->ty' on line 2082 in file 'cast.c'
>
> Kind Regards
> Benjamin Thaut
February 19, 2012
Re: Howto build a repo case for a ICE?
On 02/19/2012 02:24 PM, Benjamin Thaut wrote:
> The last dmd version I could use to actually build my project was dmd
> 2.056. Now I want to help finding those bugs that keep me from compiling
> and I'm wondering how I can build repro cases for the ICEs I encounter.
> I tried compiling with -v but that does not really give much information
> about where the crash actually happens. So I wonder what can actually be
> done to find the part of the code or even only the module it crashes in?
>
> The current ICE I'm encountering is:
> Assertion failure: 't1->ty == t2->ty' on line 2082 in file 'cast.c'
>
> Kind Regards
> Benjamin Thaut

DustMite is an useful tool for generating reduced cases that cause the 
same ICE:

https://github.com/CyberShadow/DustMite
February 19, 2012
Re: Howto build a repo case for a ICE?
On 19.02.2012 14:24, Benjamin Thaut wrote:
> The last dmd version I could use to actually build my project was dmd
> 2.056. Now I want to help finding those bugs that keep me from compiling
> and I'm wondering how I can build repro cases for the ICEs I encounter.
> I tried compiling with -v but that does not really give much information
> about where the crash actually happens. So I wonder what can actually be
> done to find the part of the code or even only the module it crashes in?
>
> The current ICE I'm encountering is:
> Assertion failure: 't1->ty == t2->ty' on line 2082 in file 'cast.c'

If you don't mind building the compiler,
add this line just before 2082:
if (t1->ty != t2->ty) e1->error("ICE");

and then build the compiler.

Sorry for the newbie-hostile comment. But it would save you a lot of time.
February 19, 2012
Re: Howto build a repo case for a ICE?
Am 19.02.2012 14:44, schrieb Timon Gehr:
> On 02/19/2012 02:24 PM, Benjamin Thaut wrote:
>> The last dmd version I could use to actually build my project was dmd
>> 2.056. Now I want to help finding those bugs that keep me from compiling
>> and I'm wondering how I can build repro cases for the ICEs I encounter.
>> I tried compiling with -v but that does not really give much information
>> about where the crash actually happens. So I wonder what can actually be
>> done to find the part of the code or even only the module it crashes in?
>>
>> The current ICE I'm encountering is:
>> Assertion failure: 't1->ty == t2->ty' on line 2082 in file 'cast.c'
>>
>> Kind Regards
>> Benjamin Thaut
>
> DustMite is an useful tool for generating reduced cases that cause the
> same ICE:
>
> https://github.com/CyberShadow/DustMite

Which dmd version should I use to build DustMite?
I tried 2.055 and 2.058 but DustMite crashes half way through the 
reductino process without a message (I'm using windows)
February 19, 2012
Re: Howto build a repo case for a ICE?
Am 19.02.2012 15:41, schrieb Don:
> On 19.02.2012 14:24, Benjamin Thaut wrote:
>> The last dmd version I could use to actually build my project was dmd
>> 2.056. Now I want to help finding those bugs that keep me from compiling
>> and I'm wondering how I can build repro cases for the ICEs I encounter.
>> I tried compiling with -v but that does not really give much information
>> about where the crash actually happens. So I wonder what can actually be
>> done to find the part of the code or even only the module it crashes in?
>>
>> The current ICE I'm encountering is:
>> Assertion failure: 't1->ty == t2->ty' on line 2082 in file 'cast.c'
>
> If you don't mind building the compiler,
> add this line just before 2082:
> if (t1->ty != t2->ty) e1->error("ICE");
>
> and then build the compiler.
>
> Sorry for the newbie-hostile comment. But it would save you a lot of time.

Thank you very much that helped a lot. I was able to reduce it to the 
following code:

class Foo
{

  @property EntityId entityId()
  {
    return EntityId(3);
  }

}

struct EntityId
{
  uint id;

  alias id this;

  this(uint id)
  {
    this.id = id;
  }
}

int main(string[] argv)
{
  Foo foo = null;
  auto id = (foo) ? foo.entityId : -1;

  return 0;
}
February 19, 2012
Re: Howto build a repo case for a ICE?
"Benjamin Thaut" <code@benjamin-thaut.de> wrote in message 
news:jhr584$2d1v$1@digitalmars.com...
> Thank you very much that helped a lot. I was able to reduce it to the 
> following code:
>
> class Foo
> {
>
>   @property EntityId entityId()
>   {
>     return EntityId(3);
>   }
>
> }
>
> struct EntityId
> {
>   uint id;
>
>   alias id this;
>
>   this(uint id)
>   {
>     this.id = id;
>   }
> }
>
> int main(string[] argv)
> {
>   Foo foo = null;
>   auto id = (foo) ? foo.entityId : -1;
>
>   return 0;
> }

"Daniel Murphy" <yebblies@nospamgmail.com> wrote in message 
news:jhqua0$20c0$1@digitalmars.com...
>  It shouldn't be happening, but I'd guess it's something to do with alias 
> this with integral types (huge guess).  How big is the project?

Damn I'm good.
February 19, 2012
Re: Howto build a repo case for a ICE?
Am 19.02.2012 16:44, schrieb Daniel Murphy:
> "Benjamin Thaut"<code@benjamin-thaut.de>  wrote in message
> news:jhr584$2d1v$1@digitalmars.com...
>> Thank you very much that helped a lot. I was able to reduce it to the
>> following code:
>>
>> class Foo
>> {
>>
>>    @property EntityId entityId()
>>    {
>>      return EntityId(3);
>>    }
>>
>> }
>>
>> struct EntityId
>> {
>>    uint id;
>>
>>    alias id this;
>>
>>    this(uint id)
>>    {
>>      this.id = id;
>>    }
>> }
>>
>> int main(string[] argv)
>> {
>>    Foo foo = null;
>>    auto id = (foo) ? foo.entityId : -1;
>>
>>    return 0;
>> }
>
> "Daniel Murphy"<yebblies@nospamgmail.com>  wrote in message
> news:jhqua0$20c0$1@digitalmars.com...
>>   It shouldn't be happening, but I'd guess it's something to do with alias
>> this with integral types (huge guess).  How big is the project?
>
> Damn I'm good.
>
>

Create a bug ticket for it: 
http://d.puremagic.com/issues/show_bug.cgi?id=7545

The bug was introduced because I had to replace a typedef with a wrapper 
struct.

Kind Regards
Benjamin Thaut
February 19, 2012
Re: Howto build a repo case for a ICE?
Benjamin Thaut:

> Thank you very much that helped a lot. I was able to reduce it to the 
> following code:
> 
> class Foo
> {
> 
>    @property EntityId entityId()
>    {
>      return EntityId(3);
>    }
> 
> }
> 
> struct EntityId
> {
>    uint id;
> 
>    alias id this;
> 
>    this(uint id)
>    {
>      this.id = id;
>    }
> }
> 
> int main(string[] argv)
> {
>    Foo foo = null;
>    auto id = (foo) ? foo.entityId : -1;
> 
>    return 0;
> }

Reduced:

struct Foo {
  uint bar;
  alias bar this;
  this(int) {}
}
void main() {
  auto spam = true ? Foo(1) : 1;
}


Bye,
bearophile
February 19, 2012
Re: Howto build a repo case for a ICE?
On Sunday, 19 February 2012 at 15:31:32 UTC, Benjamin Thaut wrote:
> Which dmd version should I use to build DustMite?
> I tried 2.055 and 2.058 but DustMite crashes half way through 
> the reductino process without a message (I'm using windows)

I've never heard of a problem like this. Is the DustMite crash 
reproducible?
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home