+2005-12-12 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR objc/25348
+ * objc-act.c (encode_array): Handle arrays to zero sized types.
+
2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* Make-lang.in (objc.all.build, objc.install-normal): Remove.
return;
}
- sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC,
- (TREE_INT_CST_LOW (an_int_cst)
- / TREE_INT_CST_LOW (TYPE_SIZE (array_of))));
+ if (TREE_INT_CST_LOW (TYPE_SIZE (array_of)) == 0)
+ sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0);
+ else
+ sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC,
+ TREE_INT_CST_LOW (an_int_cst)
+ / TREE_INT_CST_LOW (TYPE_SIZE (array_of)));
obstack_grow (&util_obstack, buffer, strlen (buffer));
encode_type (array_of, curtype, format);
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fgnu-runtime " } */
+
+/* There was an ICE due to diving by zero in the objc front-end. */
+
+struct f
+{
+ int i;
+ struct{} g[4];
+ int tt;
+};
+
+char *e = @encode(struct f);