Another C compiler bug?

S.Jin sjin at castle.ed.ac.uk
Tue Jul 17 19:21:20 AEST 1990


Is it a bug or not? I can compile the piece of program below successfully 
on Sun 3/60(4.0_Export), HP900/825(7.00). But I failed to do that on 4D 20 
under IRIX 3.2.

The program:

struct Alist_Entry
    {
    void *slot;
    } ;
main()
{
	register struct Alist_Entry *ap;
	*( (int *) (ap->slot) ) = 11;
	*((char *)(ap->slot)) = 'a';
}

The result on 4D 20 under IRIX 3.2:
$ cc foo.c	/* Suppose the program name as foo.c */
ccom: Error: foo.c, line 8: slot undefined
        *( (int *) (ap->slot) ) = 11;
      ---------------------^
ccom: Error: foo.c, line 8: member of structure or union required
        *( (int *) (ap->slot) ) = 11;
      ---------------------^
ccom: Error: foo.c, line 9: member of structure or union required
        *((char *)(ap->slot)) = 'a';
      --------------------^
$

Is it a bug? Any comments are welcome.

S. Jin



More information about the Comp.sys.sgi mailing list