wkd@CS.UTEXAS.EDU (Bill Duttweiler) (02/14/89)
Here is what I believe to be a bug in 'gcc': ---File that may be compiled to exhibit the problem: ----cut here----- typedef struct none_of_my_business *Widget; extern void i_need_a_widget(Widget); void why_does_this_work(Widget W) { i_need_a_widget(W); } void why_doesnt_this_work(W) Widget W; { i_need_a_widget(W); } ---cut here --- ---Command executed was 'gcc -v -c gcc-bug.c'. here is the output: gcc version 1.32 /uhe2/src/gcc-sun4/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -DUNIX -D__sparc__ -D__sun__ -D__unix__ -D__UNIX__ gcc-bug.c /tmp/cca01334.cpp GNU CPP version 1.32 /uhe2/src/gcc-sun4/lib/gcc-cc1 /tmp/cca01334.cpp -quiet -dumpbase gcc-bug.c -version -o /tmp/cca01334.s GNU C version 1.32 (sparc) compiled by GNU C version 1.32. gcc-bug.c:3: warning: parameter points to incomplete type gcc-bug.c:7: warning: parameter `W' points to incomplete type gcc-bug.c: In function why_doesnt_this_work: gcc-bug.c:15: incompatible types in argument passing ---The machine I'm using is a SUN4/150, running SunOs4.0.1. tm.h is tm-sparc.h and md is sparc.md. --I believe SOMETHING is wrong in handling the opaque pointer. The function that declares 'W' in the parameter list doesn't get an error in calling 'i_need_a_widget()', while the other one does. The warnings about incomplete types are also a nusiance...the X Window stuff uses a bunch of opaque handles on things, which, of course, is how I encountered this in the first place.
partain@CS.UNC.EDU (William D. Partain, msl) (07/17/89)
From: poirier@unc (Dan Poirier) Date: Sat, 15 Jul 89 17:47:28 EDT Subject: gcc bug? Try compiling this with gcc (I did it on a Sun-3): main() { int *foo = { { 1,2 }, }; arf(); } (I know it's not valid C, but the compiler dies with a "fatal signal 11", which is a segmentation fault.) _dan It compiled (with errors) on a VAX. Here are my sun3 results [gcc set up to generate mc68010 code] (same thing on a SunOS 3.5 Sun4 [sparc]): Script started on Sun Jul 16 13:30:51 1989 % gcc -v -c temp.c gcc version 1.35 /usr/local/contrib/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Dmc68010 temp.c /tmp/cca04817.cpp GNU CPP version 1.35 /usr/local/contrib/lib/gcc-cc1 /tmp/cca04817.cpp -quiet -dumpbase temp.c -version -o /tmp/cca04817.s GNU C version 1.35 (68k, MIT syntax) compiled by GNU C version 1.35. gcc: Program cc1 got fatal signal 11. % cat /etc/motd Sun UNIX 4.2 Release 3.5 (SUN3CLIENT) #2: Wed May 10 12:32:05 EDT 1989 % script done on Sun Jul 16 13:31:43 1989 Will Partain partain@cs.unc.edu