[Bug c/17569] New: error: incompatible types in assignment
kminola at eng dot umd dot edu
gcc-bugzilla@gcc.gnu.org
Mon Sep 20 13:53:00 GMT 2004
/* Using gcc-3.4.2 with stmt 2 uncommented gives
% gcc -c foo.c
foo.c: In function `foo':
foo.c:21: error: incompatible types in assignment
%
However if you comment out stmt 2 and uncomment stmt 1, you
get
% gcc -c foo.c
%
Stmt 1 looks to be syntactically equivalent to stmt 2. Why
does one compile and the other not? This seems like a bug.
The same things happens using gcc-4.0-20040912.
Configuration Details:
% uname -a
Linux brutus 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003 i686 i686 i386 GNU/Linux
%
% gcc -v
Reading specs from /usr/local/gcc-3.4.2/x86-Linux/lib/gcc/i686-pc-linux-gnu/3.4.
2/specs
Configured with: ../gcc-3.4.2/configure --enable-languages=c --prefix=/usr/local
/gcc-3.4.2/x86-Linux
Thread model: posix
gcc version 3.4.2
%
*/
typedef struct
{
int a;
} t_a;
typedef struct
{
t_a b;
} t_b;
void foo(c)
t_b *c;
{
/* stmt 1 - this compiles
t_a *d = &c->b;
*/
/* stmt 2 - this does not
*/
t_a *d;
*d = &c->b;
}
--
Summary: error: incompatible types in assignment
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kminola at eng dot umd dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17569
More information about the Gcc-bugs
mailing list