Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!apollo!rehrauer From: rehrauer@apollo.HP.COM (Steve Rehrauer) Newsgroups: comp.sys.apollo Subject: Re: BUG in cc int>double type conversion !!!!! Keywords: bug cc double type conversion Message-ID: <4c13efca.20b6d@apollo.HP.COM> Date: 8 Aug 90 14:48:00 GMT References: <538@al.ele.tue.nl> Sender: root@apollo.HP.COM Reply-To: rehrauer@apollo.HP.COM (Steve Rehrauer) Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 45 In article <538@al.ele.tue.nl> jos@ele.tue.nl (Jos van Eijndhoven) writes: >I just discovered a bug in the apollo 10.2 C compiler on a DN3000, >regarding int to double type conversion between two fields in a union. >The problem is shown by the following tiny program: > >/****** show cc bug in union type conversion *****/ >#include >main() >{ union > { int i; > double f; > } val; > double f; > > val.i = 1; > > f = (double)(val.i); > val.f = (double)(val.i); > printf("f = %g, val.f = %g\n", f, val.f); >} >/**************************************************/ > >The program will print two different values!!! >Changing the order of int and double in the union doesn't help. >Changing the union to a struct removes the error. > >I am severely hindered by this bug in a larger program. >Is this problem known already, and if so is there a patch available? >Does anybody know an easy way to circumvent the problem? Jos, I've verified that the bug exists in 6.7 C, and that it is fixed in 6.8. The 6.8 C compiler belongs to what we're internally calling the "CR1.0" compiler release, and is currently in Beta test. Gee, it'd be nice if you volunteered to be a CR1.0 Beta site! :-) However, more realistically, there is also a patched 6.7 C that fixes this problem. Ask your friendly neighborhood customer-service rep for the latest 6.7 C compiler, referred to internally as "1989.1 plus". >Any help appreciated, You're welcome. -- >>"Aaiiyeeee! Death from above!"<< | (Steve) rehrauer@apollo.hp.com "Spontaneous human combustion - what luck!"| Apollo Computer (Hewlett-Packard)