[Issue 8095] [64 bit] Wrong code generation with ref parameters, -m64 -O

2012-05-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8095



--- Comment #2 from Kenji Hara  2012-05-15 04:41:04 PDT ---
This is similar to bug 8093.
It occurs in Windows 7 64-bit, and the cause is accessing ref variable in outer
scope from nested function.

int g;
ref int foo() {
   ref int __result;
   Container c;
   switch(c.opApply((ref int n){
   __result = g;   // accessing ref variable from nested function
   return 2;
   return 0;
   })){
   default: break;
   case 2: return __vresult;
   }
   return g;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8095] [64 bit] Wrong code generation with ref parameters, -m64 -O

2012-05-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8095


Don  changed:

   What|Removed |Added

Summary|[64 bit] Wrong code |[64 bit] Wrong code
   |generation with ref |generation with ref
   |parameters, -m64 -O -inline |parameters, -m64 -O


--- Comment #1 from Don  2012-05-15 04:14:08 PDT ---
'Reduced' test case doesn't require -inline. This is a pure optimizer bug.
It requires a nested function, but the nested function isn't actually used.

void bug8095(int z, ref int p1, ref int p2, int xxx, ref int p4, ref int p5)
{
int x = z / 3;
void never_used()
{
p4 = 0;
int unused = 0;
if (x == 4) unused = 1;
}
if (z >= 0) {
p1 = 0;
p4 = 0;
p5 = 0;
int c = 0;
if ( z / 5 )
c = 1;
p2 = c;
x = c;
}

}

void main()
{
int  x1, x2, x4, x5;
bug8095(0, x1, x2, 0, x4, x5);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8095] [64 bit] Wrong code generation with ref parameters, -m64 -O -inline

2012-05-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8095


Don  changed:

   What|Removed |Added

   Keywords||wrong-code
   Severity|normal  |critical


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---