Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!swrinde!cs.utexas.edu!mailrus!iuvax!watmath!watcgl!fjhenigman From: fjhenigman@watcgl.waterloo.edu (Frank J. Henigman) Newsgroups: comp.sys.sgi Subject: Passing floats - Is this a bug? Message-ID: <11787@watcgl.waterloo.edu> Date: 5 Oct 89 20:41:51 GMT Distribution: comp Organization: U of Waterloo, Ontario Lines: 45 Take a look at the following program. ------------------------------------------------------------------ bar(x) float *x; { printf("bar: %f\n", *x); } foo(x) float x; { printf("foo: %f\n", x); bar(&x); } main() { float x = 1.0; foo(x); } ------------------------------------------------------------------ Here is the output of this program compiled and run on a 4D/120GTX with 3.1G foo: 1.000000 bar: 1.875000 You get the same thing EVEN IF COMPILED WITH -float. Compile it with gcc and you get: foo: 1.000000 bar: 1.000000 -- fjhenigman@watcgl.uwaterloo.ca Computer Graphics Lab fjhenigman@watcgl.waterloo.edu Frank J. Henigman University of Waterloo ...!watmath!watcgl!fjhenigman Waterloo, Ontario, Canada -- fjhenigman@watcgl.uwaterloo.ca Computer Graphics Lab fjhenigman@watcgl.waterloo.edu Frank J. Henigman University of Waterloo ...!watmath!watcgl!fjhenigman Waterloo, Ontario, Canada