Skip to content

Commit

Permalink
Merge pull request #3809 from yebblies/issue13023
Browse files Browse the repository at this point in the history
Issue 13023 - optimizer produces wrong code for comparision and division of ulong
  • Loading branch information
WalterBright committed Jul 24, 2014
2 parents f4a8858 + 1fced8b commit f79c6c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/cod3.c
Expand Up @@ -2213,6 +2213,8 @@ code* gen_testcse(code *c, unsigned sz, targ_uns i)
FLcs,i, FLconst,(targ_uns) 0);
if ((I64 || I32) && sz == 2)
c->Iflags |= CFopsize;
if (I64 && sz == 8)
code_orrex(c, REX_W);
return c;
}

Expand Down
15 changes: 15 additions & 0 deletions test/runnable/mars1.d
Expand Up @@ -218,6 +218,20 @@ void testarrayinit()

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

void test13023(ulong n)
{
static void func(bool b) {}

ulong k = 0;

func(k >= n / 2);

if (k >= n / 2)
assert(0);
}

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

struct U { int a; union { char c; int d; } long b; }

U f = { b:3, d:2, a:1 };
Expand Down Expand Up @@ -1222,6 +1236,7 @@ int main()
test10715();
test10678();
test7565();
test13023(0x10_0000_0000);
test12833();
test9449();
test12057();
Expand Down

0 comments on commit f79c6c5

Please sign in to comment.