www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - long problems

reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
quick question - will the following code do as I expect?

long x;

x = -1;

assert(x == -1);

cuz I've hit a spot where the optimizer isn't loading the high dword into x
Dec 22 2010
next sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 12/22/2010 11:04 PM, Ellery Newcomer wrote:
 quick question - will the following code do as I expect?

 long x;

 x = -1;

 assert(x == -1);

 cuz I've hit a spot where the optimizer isn't loading the high dword into x

nevermind, it's failing with x = cast(long) -1 and x = -1L also
Dec 22 2010
prev sibling next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Wednesday 22 December 2010 21:04:37 Ellery Newcomer wrote:
 quick question - will the following code do as I expect?
 
 long x;
 
 x = -1;
 
 assert(x == -1);
 
 cuz I've hit a spot where the optimizer isn't loading the high dword into x

That would depend on what you expect. If you expect x to be equal 42, you're likely to be dissapointed. ;) That said, it's definitely a bug if that assertion fails - an _enormous_ bug really. Regardless, it works just fine on my machine. So, whatever the optimizer does or doesn't do, the assertion doesn't fail. - Jonathan M Davis
Dec 22 2010
parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 12/22/2010 11:10 PM, Jonathan M Davis wrote:
 That said, it's definitely a bug if that assertion fails - an _enormous_ bug
 really. Regardless, it works just fine on my machine.

try this on your machine: http://d.puremagic.com/issues/show_bug.cgi?id=5364
 - Jonathan M Davis

Dec 22 2010
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Wednesday 22 December 2010 21:57:06 Ellery Newcomer wrote:
 On 12/22/2010 11:10 PM, Jonathan M Davis wrote:
 That said, it's definitely a bug if that assertion fails - an _enormous_
 bug really. Regardless, it works just fine on my machine.

try this on your machine: http://d.puremagic.com/issues/show_bug.cgi?id=5364
 - Jonathan M Davis


Without optimizations on, it works just fine, but it does fail on my machine when compiling with -O. Definitely a bug. - Jonathan M Davis
Dec 22 2010