re PR objc/25348 (ICE encoding zero sized struct array)

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-12  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/25348
        * objc.dg/encode-9.m: New test.

From-SVN: r108432
This commit is contained in:
Andrew Pinski 2005-12-12 23:58:16 +00:00 committed by Andrew Pinski
parent 59ced94791
commit 6b990f0dd7
4 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -7920,9 +7920,12 @@ encode_array (tree type, int curtype, int format)
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);

View File

@ -1,3 +1,8 @@
2005-12-12 Andrew Pinski <pinskia@physics.uc.edu>
PR objc/25348
* objc.dg/encode-9.m: New test.
2005-12-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR testsuite/20772

View File

@ -0,0 +1,13 @@
/* { 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);