battle@alphard.cs.utk.edu (David Battle) (01/03/90)
I seem to have discovered a bug in DEC's Ultrix C compilers. The bug exhibits itself on both vax and mips architectures. The problem is that it seems to ignore objects declared as "void *". Here is an example, straight out of K&R2 (page 121): First, on a DECStation 3100: mips> head -1 /etc/motd Ultrix Worksystem V2.1 (Rev. 14) System #2: Mon Nov 6 11:22:25 EST 1989 mips> cat tmp.c void swap(void *v[], int i, int j) { void *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; } mips> cc -c tmp.c ccom: Error: tmp.c, line 6: temp undefined temp = v[i]; ---------^ ccom: Warning: tmp.c, line 6: illegal combination of pointer and integer, op = temp = v[i]; ---------------^ ccom: Warning: tmp.c, line 8: illegal combination of pointer and integer, op = v[j] = temp; ---------------^ (ccom): tmp.c, line 8: cannot recover from earlier errors: goodbye! } ^ And on the MicroVax (doesn't handle prototypes yet): vax> head -1 /etc/motd Ultrix-32 V3.0 (Rev 64) UWS V2.0 System #2: Fri Aug 4 00:02:44 EDT 1989 vax> more foo.c void swap(v,i,j) void *v[]; int i, j; { void *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; } vax> cc -c foo.c "foo.c", line 8: temp undefined "foo.c", line 8: warning: illegal combination of pointer and integer, op = "foo.c", line 10: warning: illegal combination of pointer and integer, op = The unprotoized version works fine on a sun: sun> cat > foo.c swap(v,i,j) void *v[]; int i, j; { void *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; } sun> cc -c foo.c sun> Am I missing something here, or is this a real bug? -David L. Battle battle@battle.esd.ornl.gov battle@utkux1.utk.edu