🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2135

complaints about `incomplete types' for same type

#2135
From: Ken Raeburn
Date: Sun, 08 Jan 1989 13:27
51 lines
2094 bytes
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
Technical Details
Message-ID: <8901081327.AA04061@STEVE-DALLAS.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!raeburn

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!raeburn
From: raeburn@ATHENA.MIT.EDU (Ken Raeburn)
Newsgroups: gnu.gcc.bug
Subject: complaints about `incomplete types' for same type
Message-ID: <8901081327.AA04061@STEVE-DALLAS.MIT.EDU>
Date: 8 Jan 89 13:27:57 GMT
Sender: root@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 51