Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!lsr-vax.UUCP!lmo From: lmo@lsr-vax.UUCP ("Lance M. Optican - LMO") Newsgroups: comp.sys.sgi Subject: Re: 3.2 C compiler bug Message-ID: <9005071321.AA27323@> Date: 7 May 90 13:21:34 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 61 There is a bug in the Irix C-compiler: ----- Begin Included Message ----- Date: 2 May 90 16:47:35 GMT From: "Frank J. Henigman" Organization: Computer Graphics Laboratory, University of Waterloo, Ontario, Canada Subject: 3.2 C compiler bug Message-Id: <1990May2.164735.27436@watcgl.waterloo.edu> Sender: uunet!BRL.MIL!info-iris-request To: info-iris@BRL.MIL Status: RO The following program prints zero but it should print 1. If you modify the program so that foo() does not return a struct it works as expected. struct crud { long x; } w; struct crud foo( float f, long k ) { printf( "%ld\n", k ); return w; } main() { foo( 0.0, 1L ); } -- fjhenigman@watcgl.uwaterloo.ca Computer Graphics Lab fjhenigman@watcgl.waterloo.edu Frank J. Henigman University of Waterloo ...!watmath!watcgl!fjhenigman Waterloo, Ontario, Canada ----- End Included Message ----- This seems to be a problem with the function prototyping. If you change to the old-fashioned 'C' convention, the problem goes away: struct crud { long x; } w; struct crud foo(f, k ) float f; long k; { printf( "%ld\n", k ); return w; } main() { foo( 0.0, 1L ); } Good Luck, Lance M. Optican Laboratory of Sensorimotor Research National Eye Institute