http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53086

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-24 
09:29:10 UTC ---
A "fix" would be for example

Index: gcc/expr.c
===================================================================
--- gcc/expr.c  (revision 186757)
+++ gcc/expr.c  (working copy)
@@ -6809,7 +6809,8 @@ array_at_struct_end_p (tree ref)

   /* If the reference is based on a declared entity, the size of the array
      is constrained by its given domain.  */
-  if (DECL_P (ref))
+  if (DECL_P (ref)
+      && !DECL_COMMON (ref))
     return false;

   return true;

of course other parts of the compiler will still be affected by this.
If the Frontend wants to reliably make this work then it has to use
an open-ended TYPE_DOMAIN for the array (and then lay out the underlying
decl manually).  Not sure if that's easy though (the incomplete type might
trigger ICEs in other places).

Reply via email to