[comp.sys.sgi] Another C compiler bug?

sjin@castle.ed.ac.uk (S.Jin) (07/17/90)

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

dwatts@ki.UUCP (Dan Watts) (07/18/90)

In article <5193@castle.ed.ac.uk> sjin@castle.ed.ac.uk (S.Jin) writes:
>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.

 ... source code deleted ...

If you change the 'void' to 'int' it compiles fine.  My guess is that 3.2
doesn't handle the 'void *' type.  Perhaps they do in 3.3?
-- 
#####################################################################
# CompuServe: >INTERNET:uunet.UU.NET!ki!dwatts    Dan Watts         #
# UUCP      : ...!uunet!ki!dwatts                 Ki Research, Inc. #
############### New Dimensions In Network Connectivity ##############

davea@quasar.wpd.sgi.com (David B. Anderson) (07/18/90)

In article <5193@castle.ed.ac.uk>, sjin@castle.ed.ac.uk (S.Jin) writes:
> 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.
[stuff deleted]
> struct Alist_Entry 
>     { 
>     void *slot; 
>     } ;
> ccom: Error: foo.c, line 8: slot undefined
>         *( (int *) (ap->slot) ) = 11;
[stuff deleted]
> Is it a bug? Any comments are welcome.

Another posting (name not mentioned here) suggested user error. 

To correct any misunderstanding this may cause:
This is a compiler bug.  void, void * work in 3.3 cc but *not* in 3.2.

Regards,
[ David B. Anderson  Silicon Graphics  (415)335-1548  davea@sgi.com ]
[``What can go wrong?''                          --Calvin and Hobbes]