[Issue 3521] Optimized code access popped register
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 27 00:15:10 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3521
--- Comment #2 from Don <clugdbug at yahoo.com.au> 2009-11-27 00:15:10 PST ---
I investigated this a bit, so far without success. I'm writing notes here for
when I come back to it.
It's something to do with the register allocation. The compiler is somehow
forgetting that it already assigned a register for c when doing the assignment.
I removed the assert to make disassembly even easier: this hits a breakpoint
only when compiled with -O. It only happens if c is zero. You can change the !=
into any kind of comparison, and the c=200 into c+=200, without affecting the
bug. However, changing it into ((c = 200)!=*a) avoids the bug.
void crash(int x)
{
if (x==200) return;
asm { int 3; }
}
void bug3521(int *a){
int c = 0;
*a = 0;
if ( *a || (*a != (c = 200)) )
crash(c);
}
void main (){
int x;
bug3521(&x);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list