egcs-1.1 bug?? using semctl() on SuSE linux 5.1

Paul Shields shields@passport.ca
Sat Nov 14 10:39:00 GMT 1998


Hello,
I'm using SuSE linux 5.1 and just installed binutils-2.9.1 and egcs-1.1b
to try out compiling a big whack of existing code for a new project.
egcs reports an error with the following code fragment where gcc-2.7.2.1
did not.  The question of course is, what should it have done?


=== semfu.c ===
# include <sys/types.h>
# include <sys/ipc.h>
# include <sys/sem.h>

int semfu(int *sem)
{
        return semctl(*sem, 0, IPC_RMID, 0);
}


$ gcc semfu.c -c
$
$ egcs semfu.c -c
semfu.c: In function `semfu':
semfu.c:7: incompatible type for argument 4 of `semctl'


Now looking at the man page for semctl(), we see that argument 4 is a union:

union semun {
  int val;                      /* value for SETVAL */
  struct semid_ds *buf;         /* buffer for IPC_STAT & IPC_SET */
  ushort *array;                /* array for GETALL & SETALL */
  struct seminfo *__buf;        /* buffer for IPC_INFO */
  void *__pad;
};


--
Paul Shields, mailto:shields@custodians.com

Custodian Software Inc. 962 Bloor Street West Toronto, Ontario M6H 1L6
Tel: +1 416 537-0015   Fax: +1 416 536-5793






More information about the Gcc-bugs mailing list