Created attachment 1523
reduced_expr.d
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 reduced_expr.d (http://dpaste.dzfl.pl/raw/e7a66aa067ab)
When I compile this file using: 'dmd -c -O reduced_expr.d' it fails with:
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.
Using dustmite, the expression in the file reduces to:
double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized)
{
return (TicksTenMinutesNormalized?1:AvgPriceChangeNormalized)1:TicksTenMinutesNormalized/(TicksTenMinutesNormalized==0)==0;
}
This internal error has been reproduced on Linux (x86_64) and MacOS and on DMD versions 2.066.1 and 2.067.1.
Comment #1 by dfj1esp02 — 2015-05-21T12:30:38Z
Failing valid code is
double someFunction(double a, double c)
{
return ((c==0?1:a)==0?1:c/(c==0?1:a))==0 ? 1 : c;
}
Comment #2 by acehreli — 2015-05-21T15:49:04Z
Further reduced by Kagamin:
double foo(double b)
{
return b / (b == 0) == 0;
}
(Remember, one needs -O to reproduce.)
Ali