3.2 C compiler bug
Lance M. Optican - LMO
lmo at lsr-vax.UUCP
Mon May 7 23:21:34 AEST 1990
There is a bug in the Irix C-compiler:
----- Begin Included Message -----
Date: 2 May 90 16:47:35 GMT
From: "Frank J. Henigman" <uunet!ucbvax.berkeley.edu!att!watmath!watserv1!watcgl!fjhenigman>
Organization: Computer Graphics Laboratory, University of Waterloo, Ontario, Canada
Subject: 3.2 C compiler bug
Message-Id: <1990May2.164735.27436 at watcgl.waterloo.edu>
Sender: uunet!BRL.MIL!info-iris-request
To: info-iris at 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 at watcgl.uwaterloo.ca Computer Graphics Lab
fjhenigman at 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
More information about the Comp.sys.sgi
mailing list