Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!mcnc!duke!cameron!dukee!amr From: amr@dukee.egr.duke.edu (Anthony M. Richardson) Newsgroups: comp.unix.aix Subject: AIX 1.1 C compiler bug? Message-ID: <677@cameron.cs.duke.edu> Date: 4 Mar 90 23:56:54 GMT Sender: news@cameron.cs.duke.edu Lines: 34 The following simple program illustrates what I believe is a bug in the AIX 1.1 C compiler. #include main() { sub1(0.9); } int sub1(tick) float tick; { sub2(&tick); printf("tick %f\n",tick); } int sub2(tick) float *tick; { *tick = 0.5; } The value printed by the printf in routine sub1() is 0.9, not 0.5. The bug only appears when the address of a function argument is passed to sub2(), i.e. #include main() { float tick=0.9; sub2(&tick); printf("tick %f\n",tick); } works correctly (prints 0.5). This is a bug isn't it? (I thought register variables where the only types you couldn't use the address of operator (&) on.) I can get around it by using int sub1(tick) float tick; { float dummy; dummy=tick; sub2(&dummy); tick=dummy; } but it took me awhile to find the bug in the first place. Tony Richardson amr@dukee.egr.duke.edu take the address of