ftp.nice.ch/peanuts/GeneralData/Usenet/news/1989/CSN-89.tar.gz#/comp-sys-next/1989/Jan-Apr/NeXT-C-compiler-bug-in-0.8-system-software

This is NeXT-C-compiler-bug-in-0.8-system-software in view mode; [Up]


Date: Sun 05-Apr-1989 16:42:37 From: Unknown Subject: NeXT C compiler bug in 0.8 system software The following program will fail to produde the correct result, and will emit the "Can't convert unsigned long to double" message on the NeXT. It works just fine on various platforms, including MicroVAX running 4.3BSD tahoe with either the standard PCC based C compiler, or the GNU CC 1.34. #include <stdio.h> main() { double dbl = 1024.0 * 1024.0 * 1024.0; /* 2^30 */ unsigned long ul = 3.0 * dbl; /* between 2^31 and 2^32 */ printf("3.0*1024.0*1024.0*1024.0 = 0x%08x\n", ul); if (ul != 0xc0000000) { printf("Can't convert unsigned long to double.\n"); exit(1); } exit(0); } The correct result should be: 3.0*1024.0*1024.0*1024.0 = 0xc0000000 while running it on the NeXT results in: 3.0*1024.0*1024.0*1024.0 = 0xffffffff Can't convert unsigned long to double. which is clearly bogus. Running it with or without the -O option doesn't seem to have any effect. Louis A. Mamakos WA3YMH Internet: louie@TRANTOR.UMD.EDU University of Maryland, Computer Science Center - Systems Programming >From: jgreely@previous.cis.ohio-state.edu (J Greely)
Date: Sun 05-Apr-1989 16:42:37 From: Unknown Subject: NeXT C compiler bug in 0.8 system software The following program will fail to produde the correct result, and will emit the "Can't convert unsigned long to double" message on the NeXT. It works just fine on various platforms, including MicroVAX running 4.3BSD tahoe with either the standard PCC based C compiler, or the GNU CC 1.34. #include <stdio.h> main() { double dbl = 1024.0 * 1024.0 * 1024.0; /* 2^30 */ unsigned long ul = 3.0 * dbl; /* between 2^31 and 2^32 */ printf("3.0*1024.0*1024.0*1024.0 = 0x%08x\n", ul); if (ul != 0xc0000000) { printf("Can't convert unsigned long to double.\n"); exit(1); } exit(0); } The correct result should be: 3.0*1024.0*1024.0*1024.0 = 0xc0000000 while running it on the NeXT results in: 3.0*1024.0*1024.0*1024.0 = 0xffffffff Can't convert unsigned long to double. which is clearly bogus. Running it with or without the -O option doesn't seem to have any effect. Louis A. Mamakos WA3YMH Internet: louie@TRANTOR.UMD.EDU University of Maryland, Computer Science Center - Systems Programming >From: jgreely@previous.cis.ohio-state.edu (J Greely)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.