====
extern int i;
extern int i;
int i[] = { 0 };
====
The problem is that 'finish_decl' ends up calling 'composite_type' with
incompatible types when updating the type of the declaration of 'i'
already encountered.
The attached patch fixes this by only calling 'composite_type' if
'comptypes' returned a non-zero value, as stated in this function's
documentation.
I've successfully bootstrapped and tested it on
x86_64-apple-darwin10.6.0. Is it OK for trunk?
Best regards,
Simon
2011-05-01 Simon Martin <simartin@users.sourceforge.net>
PR c/35445
* c-decl.c (finish_decl): Only create a composite if the types are
compatible.
===================================================================
@@ -4246,7 +4246,7 @@
b_ext = b_ext->shadowed;
if (b_ext)
{
- if (b_ext->u.type)
+ if (b_ext->u.type && comptypes (b_ext->u.type, type))
b_ext->u.type = composite_type (b_ext->u.type, type);
else
b_ext->u.type = type;