Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 13485 - FP wrong-code with -O #4394

Merged
merged 1 commit into from Feb 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backend/glocal.c
Expand Up @@ -213,6 +213,7 @@ STATIC void local_exp(elem *e,int goal)
if (em->Eoper == op &&
em->E1->EV.sp.Vsym == s &&
tysize(em->Ety) == tysize(e1->Ety) &&
!tyfloating(em->Ety) &&
em->E1->EV.sp.Voffset == e1->EV.sp.Voffset &&
!el_sideeffect(em->E2)
)
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/mars1.d
Expand Up @@ -1187,6 +1187,22 @@ void test13190()

////////////////////////////////////////////////////////////////////////

double foo13485(double c, double d)
{
// This must not be optimized to c += (d + d)
c += d;
c += d;
return c;
}

void test13485()
{
enum double d = 0X1P+1023;
assert(foo13485(-d, d) == d);
}

////////////////////////////////////////////////////////////////////////

void test12833a(int a)
{
long x = cast(long)a;
Expand Down Expand Up @@ -1294,6 +1310,7 @@ int main()
testshrshl();
test13383();
test13190();
test13485();
test10639();
test10715();
test10678();
Expand Down