Commit 93a85f02 by Eric Botcazou Committed by Eric Botcazou

tree-sra.c (maybe_lookup_element_for_expr): Return NULL for variable-sized records too.

	* tree-sra.c (maybe_lookup_element_for_expr) <COMPONENT_REF>: Return
	NULL for variable-sized records too.
	(sra_walk_expr) <COMPONENT_REF>: Stop at variable-sized records too.

From-SVN: r128553
parent 14f87433
2007-09-17 Eric Botcazou <ebotcazou@adacore.com>
* tree-sra.c (maybe_lookup_element_for_expr) <COMPONENT_REF>: Return
NULL for variable-sized records too.
(sra_walk_expr) <COMPONENT_REF>: Stop at variable-sized records too.
2007-09-17 Tom Tromey <tromey@redhat.com> 2007-09-17 Tom Tromey <tromey@redhat.com>
* c-decl.c (pushdecl): Don't set DECL_LANG_SPECIFIC. * c-decl.c (pushdecl): Don't set DECL_LANG_SPECIFIC.
...@@ -636,10 +636,17 @@ maybe_lookup_element_for_expr (tree expr) ...@@ -636,10 +636,17 @@ maybe_lookup_element_for_expr (tree expr)
break; break;
case COMPONENT_REF: case COMPONENT_REF:
/* Don't look through unions. */ {
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) != RECORD_TYPE) tree type = TREE_TYPE (TREE_OPERAND (expr, 0));
return NULL; /* Don't look through unions. */
child = TREE_OPERAND (expr, 1); if (TREE_CODE (type) != RECORD_TYPE)
return NULL;
/* Neither through variable-sized records. */
if (TYPE_SIZE (type) == NULL_TREE
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
return NULL;
child = TREE_OPERAND (expr, 1);
}
break; break;
case REALPART_EXPR: case REALPART_EXPR:
...@@ -789,14 +796,17 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output, ...@@ -789,14 +796,17 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
break; break;
case COMPONENT_REF: case COMPONENT_REF:
/* A reference to a union member constitutes a reference to the {
entire union. */ tree type = TREE_TYPE (TREE_OPERAND (inner, 0));
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0))) != RECORD_TYPE) /* Don't look through unions. */
goto use_all; if (TREE_CODE (type) != RECORD_TYPE)
/* ??? See above re non-constant stride. */ goto use_all;
if (TREE_OPERAND (inner, 2)) /* Neither through variable-sized records. */
goto use_all; if (TYPE_SIZE (type) == NULL_TREE
inner = TREE_OPERAND (inner, 0); || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
goto use_all;
inner = TREE_OPERAND (inner, 0);
}
break; break;
case REALPART_EXPR: case REALPART_EXPR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment