This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12391] New: regression: missing warning about assigning to an incomplete type
- From: "levon at movementarian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Sep 2003 14:16:25 -0000
- Subject: [Bug c/12391] New: regression: missing warning about assigning to an incomplete type
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12391
Summary: regression: missing warning about assigning to an
incomplete type
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: levon at movementarian dot org
CC: gcc-bugs at gcc dot gnu dot org
Consider:
typedef struct { int a; } b_t;
int foo() { b_t d; struct b_t * c = &d; c->a; }
gcc 3.2 says :
a.c: In function `foo':
a.c:2: warning: initialization from incompatible pointer type
a.c:2: dereferencing pointer to incomplete type
GNU C version 3.4 20030914 (experimental) (i686-pc-linux-gnu) says :
a.c: In function `foo':
a.c:2: error: dereferencing pointer to incomplete type
Note the missing warning on initialisation. This can be moderately confusing
because the latter looks exactly like a "missing header" problem, but in fact
the problem is prepending the "struct" before the typedef name, which is
actually an incomplete type of "struct b_t".
The missing warning makes it obvious that it's not as simple as a missing
header.