Jump to page: 1 2
Thread overview
Internal Compiler Error Help
May 21, 2015
Saurabh Das
May 21, 2015
Andrea Fontana
May 21, 2015
Saurabh Das
May 21, 2015
John Colvin
May 21, 2015
John Colvin
May 21, 2015
Saurabh Das
May 21, 2015
Saurabh Das
May 21, 2015
ketmar
May 21, 2015
John Colvin
May 21, 2015
Saurabh Das
May 21, 2015
Kagamin
May 21, 2015
Saurabh Das
May 21, 2015
Kagamin
May 21, 2015
Jonathan M Davis
May 21, 2015
Hello,

We have been working on a genetic programming project, and occasionally the compiler fails and gives an internal error. I've captured and reduced one of these down to a single expression. See http://dpaste.dzfl.pl/e7a66aa067ab (reduced_expr.d)

When I compile this file using: dmd -c -O reduced_expr.d

It says:
DMD 2.066.1] Internal error: backend/cod1.c 1562
DMD 2.067.1] Internal error: backend/cod1.c 1567

The compile succeeds without the '-O' flag.

Am I correct in assuming that an internal error in the compiler should be filed as a bug report?

As you can see, the expression is a massive ugly thing, as is often the case with genetic programming. I'd like to reduce this expression further before filing said bug report. I recall seeing a project on this forum which automatically figures out the simplest program which causes a compile failure. Can someone kindly point me to it?

Thanks,
Saurabh
May 21, 2015
https://github.com/CyberShadow/DustMite/wiki

On Thursday, 21 May 2015 at 08:28:30 UTC, Saurabh Das wrote:
> Hello,
>
> We have been working on a genetic programming project, and occasionally the compiler fails and gives an internal error. I've captured and reduced one of these down to a single expression. See http://dpaste.dzfl.pl/e7a66aa067ab (reduced_expr.d)
>
> When I compile this file using: dmd -c -O reduced_expr.d
>
> It says:
> DMD 2.066.1] Internal error: backend/cod1.c 1562
> DMD 2.067.1] Internal error: backend/cod1.c 1567
>
> The compile succeeds without the '-O' flag.
>
> Am I correct in assuming that an internal error in the compiler should be filed as a bug report?
>
> As you can see, the expression is a massive ugly thing, as is often the case with genetic programming. I'd like to reduce this expression further before filing said bug report. I recall seeing a project on this forum which automatically figures out the simplest program which causes a compile failure. Can someone kindly point me to it?
>
> Thanks,
> Saurabh

May 21, 2015
Thanks!

Wow, dustmite is really useful. It reduces the expression down to:

double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized)
{
    return (TicksTenMinutesNormalized?1:AvgPriceChangeNormalized)?1:TicksTenMinutesNormalized/(TicksTenMinutesNormalized==0)==0;
}

Which gives a compiler error: Internal error: backend/cod1.c 1562
May 21, 2015
On Thursday, May 21, 2015 08:28:29 Saurabh Das via Digitalmars-d-learn wrote:
> Am I correct in assuming that an internal error in the compiler should be filed as a bug report?

Yes. You should never see an ICE, and the compiler should never segfault. So, whenever you see either of those happen, please report it.

- Jonathan M Davis

May 21, 2015
On Thursday, 21 May 2015 at 08:55:45 UTC, Saurabh Das wrote:
> Thanks!
>
> Wow, dustmite is really useful. It reduces the expression down to:
>
> double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized)
> {
>     return (TicksTenMinutesNormalized?1:AvgPriceChangeNormalized)?1:TicksTenMinutesNormalized/(TicksTenMinutesNormalized==0)==0;
> }
>
> Which gives a compiler error: Internal error: backend/cod1.c 1562

make that

double foo(double a, double b)
{
    return (b ? 1 : a) ? 1 : b / (b == 0) == 0;
}

and please submit to https://issues.dlang.org

That expression is, not to put too fine a point on it, mad. The operator precedence itself is giving me a headache, let alone the division of a double by a boolean... I'm pretty sure it doesn't do what you want it to, unless what you want is seriously weird.

As a matter of fact, i'm pretty sure that expression evaluates to 1, irrelevant of the values of the two variables.
May 21, 2015
On Thursday, 21 May 2015 at 10:24:59 UTC, John Colvin wrote:
> On Thursday, 21 May 2015 at 08:55:45 UTC, Saurabh Das wrote:
>> Thanks!
>>
>> Wow, dustmite is really useful. It reduces the expression down to:
>>
>> double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized)
>> {
>>    return (TicksTenMinutesNormalized?1:AvgPriceChangeNormalized)?1:TicksTenMinutesNormalized/(TicksTenMinutesNormalized==0)==0;
>> }
>>
>> Which gives a compiler error: Internal error: backend/cod1.c 1562
>
> make that
>
> double foo(double a, double b)
> {
>     return (b ? 1 : a) ? 1 : b / (b == 0) == 0;
> }
>
> and please submit to https://issues.dlang.org
>
> That expression is, not to put too fine a point on it, mad. The operator precedence itself is giving me a headache, let alone the division of a double by a boolean... I'm pretty sure it doesn't do what you want it to, unless what you want is seriously weird.
>
> As a matter of fact, i'm pretty sure that expression evaluates to 1, irrelevant of the values of the two variables.

s/irrelevant/irrespective/
May 21, 2015
double foo(double b)
{
    return b / (b == 0) == 0;
}

Looks like this fails too.
May 21, 2015
>>
>> and please submit to https://issues.dlang.org

Submitted: https://issues.dlang.org/show_bug.cgi?id=14613

>>
>> That expression is, not to put too fine a point on it, mad. The operator precedence itself is giving me a headache, let alone the division of a double by a boolean... I'm pretty sure it doesn't do what you want it to, unless what you want is seriously weird.
>>
>> As a matter of fact, i'm pretty sure that expression evaluates to 1, irrelevant of the values of the two variables.
>
> s/irrelevant/irrespective/

The original expression was a candidate in a genetic programming population - a result of trial and error / "natural" selection over a few generations. The dustmite-reduced expression is really weird I agree - I don't know what to make of it. I've reported it as I found it.

The otiginal expression is not so wierd, it just haphazardly long. It doesn't do any strange divides or compares.

In either case, it shouldn't compile normally without the '-O' and fail to compile with it.

We managed a 1000x speed up over Java on our genetic programming system by using D, but this compile failure is preventing us from using the release / optimised builds :((

Thanks,
Saurabh

May 21, 2015
PS: The original expression: http://dpaste.dzfl.pl/raw/e7a66aa067ab

double someFunction(double AvgPriceChangeNormalized, double DayFactor, double TicksTenMinutesNormalized)
{
    return ((((AvgPriceChangeNormalized)*(0.0868))*((DayFactor)*(TicksTenMinutesNormalized)))*(((AvgPriceChangeNormalized)*(0.0868))*(((((((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)+(DayFactor)))==0)?(1):((TicksTenMinutesNormalized)/((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)+(DayFactor)))))==0)?(1):(((TicksTenMinutesNormalized)+(-0.865))/((((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)+(DayFactor)))==0)?(1):((TicksTenMinutesNormalized)/((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)+(DayFactor)))))))*(TicksTenMinutesNormalized))));
}
May 21, 2015
On Thu, 21 May 2015 11:36:14 +0000, Saurabh Das wrote:

> PS: The original expression: http://dpaste.dzfl.pl/raw/e7a66aa067ab
> 
> double someFunction(double AvgPriceChangeNormalized, double DayFactor,
> double TicksTenMinutesNormalized)
> {
>      return
> ((((AvgPriceChangeNormalized)*(0.0868))*((DayFactor)*
(TicksTenMinutesNormalized)))*(((AvgPriceChangeNormalized)*(0.0868))*
(((((((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/
(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)
+(DayFactor)))==0)?(1):((TicksTenMinutesNormalized)/
((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/
(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)
+(DayFactor)))))==0)?(1):(((TicksTenMinutesNormalized)+(-0.865))/
((((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/
(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)
+(DayFactor)))==0)?(1):((TicksTenMinutesNormalized)/
((((TicksTenMinutesNormalized)==0)?(1):((AvgPriceChangeNormalized)/
(TicksTenMinutesNormalized)))-((TicksTenMinutesNormalized)
+(DayFactor)))))))*(TicksTenMinutesNormalized))));
> }

now i have to find a way to unsee it...

« First   ‹ Prev
1 2