Path: utzoo!attcan!uunet!mcsun!hp4nl!tuegate.tue.nl!al.ele.tue.nl!jos From: jos@ele.tue.nl (Jos van Eijndhoven) Newsgroups: comp.sys.apollo Subject: BUG in cc int>double type conversion !!!!! Keywords: bug cc double type conversion Message-ID: <538@al.ele.tue.nl> Date: 7 Aug 90 13:12:48 GMT Sender: jos@ele.tue.nl (Jos van Eijndhoven) Organization: Eindhoven University of Technology, The Netherlands Lines: 35 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? Any help appreciated, Jos van Eijndhoven Eindhoven University of Technology The Netherlands jos@es.ele.tue.nl