re PR tree-optimization/43164 (ice in completely_scalarize_record, at tree-sra.c:85)

2010-03-04  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43164
	PR tree-optimization/43191
	* tree-sra.c (type_consists_of_records_p): Reject records with
	zero-size bit-fields at the end.

	* testsuite/gcc.c-torture/compile/pr43164.c: New test.
	* testsuite/gcc.c-torture/compile/pr43191.c: Likewise.

From-SVN: r157232
This commit is contained in:
Martin Jambor 2010-03-04 19:16:32 +01:00 committed by Martin Jambor
parent 83ff92fb26
commit 76f76cd0e5
5 changed files with 86 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2010-03-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43164
PR tree-optimization/43191
* tree-sra.c (type_consists_of_records_p): Reject records with
zero-size bit-fields at the end.
2010-03-04 Mike Stump <mikestump@comcast.net> 2010-03-04 Mike Stump <mikestump@comcast.net>
* Makefile.in (TAGS): Remove *.y. * Makefile.in (TAGS): Remove *.y.

View File

@ -1,3 +1,10 @@
2010-03-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43164
PR tree-optimization/43191
* gcc.c-torture/compile/pr43164.c: New test.
* gcc.c-torture/compile/pr43191.c: Likewise.
2010-03-04 Janus Weil <janus@gcc.gnu.org> 2010-03-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/43244 PR fortran/43244

View File

@ -0,0 +1,16 @@
struct S0
{
unsigned char f0;
int:0;
};
struct S1
{
struct S0 f0;
};
struct S1 func_34 (void)
{
struct S1 l_221 = { { 1 } };
return l_221;
}

View File

@ -0,0 +1,46 @@
struct S0
{
};
struct S1
{
unsigned f0:27;
const unsigned:0;
};
struct S2
{
unsigned f2:1;
};
unsigned char g_4[1][8][3][1][1][1];
unsigned char *g_17;
unsigned char **g_16[1][10][7];
struct S2 g_35 = {
0
};
struct S2 *g_34 = &g_35;
struct S1 func_86 (unsigned char p_87, struct S2 **p_89)
{
struct S1 l_92[6][8][1][1] = {
16143586
}
;
return l_92[0][0][0][0];
}
void func_28 (struct S1 p_30, const struct S1 p_32)
{
}
void func_70 (unsigned char p_72)
{
unsigned char *const *l_93 = &g_17;
struct S2 **l_94;
unsigned char *const *l_97 = &g_17;
func_28 (func_86 (p_72, 0),
func_86 (p_72, &g_34));
}

View File

@ -802,13 +802,15 @@ create_access (tree expr, gimple stmt, bool write)
/* Return true iff TYPE is a RECORD_TYPE with fields that are either of gimple /* Return true iff TYPE is a RECORD_TYPE with fields that are either of gimple
register types or (recursively) records with only these two kinds of register types or (recursively) records with only these two kinds of fields.
fields. */ It also returns false if any of these records has a zero-size field as its
last field. */
static bool static bool
type_consists_of_records_p (tree type) type_consists_of_records_p (tree type)
{ {
tree fld; tree fld;
bool last_fld_has_zero_size = false;
if (TREE_CODE (type) != RECORD_TYPE) if (TREE_CODE (type) != RECORD_TYPE)
return false; return false;
@ -821,7 +823,13 @@ type_consists_of_records_p (tree type)
if (!is_gimple_reg_type (ft) if (!is_gimple_reg_type (ft)
&& !type_consists_of_records_p (ft)) && !type_consists_of_records_p (ft))
return false; return false;
last_fld_has_zero_size = tree_low_cst (DECL_SIZE (fld), 1) == 0;
} }
if (last_fld_has_zero_size)
return false;
return true; return true;
} }