view run/d/double_27_B.d @ 1576:b3e16c86558e

[Issue 1398] New: GDC doesn't generate correct code <mariusmuja@gmail.com> 2007-08-04 http://d.puremagic.com/issues/show_bug.cgi?id=1398
author thomask
date Thu, 21 Feb 2008 15:20:08 +0000
parents c2931e457792
children
line wrap: on
line source

// $HeadURL$
// $Date$
// $Author$

// based on: gcc.c-torture/execute/ieee/930529-1.c

module dstress.run.d.double_27_B;

int main (){
	union D {
		double d;
		ubyte[8] c;
	};

	D d;
	d.d = 1.0/7.0;

	version(LittleEndian){
		if(
			d.c[0] == 0x92
			&& d.c[1] == 0x24
			&& d.c[2] == 0x49
			&& d.c[3] == 0x92
			&& d.c[4] == 0x24
			&& d.c[5] == 0x49
			&& d.c[6] == 0xc2
			&& d.c[7] == 0x3f
		){
			return 0;
		}
	}else version(BigEndian){
		if(
			d.c[7] == 0x92
			&& d.c[6] == 0x24
			&& d.c[5] == 0x49
			&& d.c[4] == 0x92
			&& d.c[3] == 0x24
			&& d.c[2] == 0x49
			&& d.c[1] == 0xc2
			&& d.c[0] == 0x3f
		){
			return 0;
		}
	}else{
		static assert(0);
	}

	assert(0);
}