Bug with gcc version egcs-2.90.29 980515 (egcs-1.0.3 release) / IRIX 6.3
Jerry James
jerry@cs.ucsb.edu
Tue Jun 16 13:18:00 GMT 1998
Remi Lehn wrote:
> I think there is a bug with gcc version egcs-2.90.29 980515
> (egcs-1.0.3 release) under Irix 6.3 when passing the fourth argument
> to the semctl() syscall, using the n32 abi. Here's a sample code
> (test-semctl.c) :
There's one bug in your code:
> semun.array = array[0];
should be:
semun.array = array;
but that doesn't affect the outcome. Inspecting the assembly code
output by each compiler shows that cc and gcc agree that the arguments
are to be passed in registers $4, $5, $6, and $7. I guess that means
that gcc is loading the wrong value into $7, but I'm not enough of a
MIPS assembly hacker to figure out where it went wrong.
> ) with the n32 abi of irix ? (printf() has a strange behavior too when
> missing an explicit declaration; the program :
That's because you don't have a prototype for printf. The compiler
should have warned you about that. Without a prototype, the double
argument would be passed in $f12, a floating point register. With
variable argument functions, however, arguments (of any type) are passed
in up to 8 of the integer registers and then the stack. Include stdio.h
(or explicitly add a full prototype for printf), and your second program
compiles correctly. Note that SGI's cc gets it wrong without the
prototype, too, although it emits a warning.
--
Jerry James
Email: jerry@cs.ucsb.edu
WWW: http://www.cs.ucsb.edu/~jerry/
More information about the Gcc-bugs
mailing list