[gnu.gcc.bug] complaints about `incomplete types' for same type

raeburn@ATHENA.MIT.EDU (Ken Raeburn) (01/08/89)

I think gcc's behavior is incorrect here, according to the dpANS.
(According to 3.1.2.6, "two types have compatible type if their types
are the same.")

 [multics!raeburn:/mit/raeburn]
<1075  6:30am> % cat foo.c
/*
 * foo
 */

typedef struct _WidgetInfo *Widget;

struct frob {
    struct frob *next;
    Widget w;
};

void frob_widget (struct frob *f);
void tweak (Widget w);

void frob_widget (struct frob *f) {
    tweak (f->w);
}
 [multics!raeburn:/mit/raeburn]
<1076  6:32am> % gcc -S -v foo.c 
gcc version 1.32
 /mit/gnu/vaxlib/gcc-cpp -v -undef -D__GNUC__ -Dvax -Dunix -D__vax__ -D__unix__ foo.c /tmp/cc001184.cpp
GNU CPP version 1.32
 /mit/gnu/vaxlib/gcc-cc1 /tmp/cc001184.cpp -quiet -dumpbase foo.c -version -o foo.s
GNU C version 1.32 (vax) compiled by GNU C version 1.32.
foo.c:13: warning: parameter `w' points to incomplete type
foo.c: In function frob_widget:
foo.c:16: incompatible types in argument passing
Exit 1               gcc -S -v foo.c
 [multics!raeburn:/mit/raeburn]
<1077  6:32am> % 

This example is stripped down from some stuff I'm starting to work on
again after a while that uses the X11 toolkit.

I've spent a couple of hours digging around in the dpANS (having
missing the obvious for a while), and I don't think there's anything
in there that says the above code is invalid (given 3.1.2.6 -- I
didn't see anything else useful that referred to incomplete structure
types except a footnote to 3.5.2.3), so if I'm wrong, please point me
to section and paragraph.  As I understand it, as long as the types
are the same, even if the structure type pointed to is incomplete,
they are compatible.

-- Ken