| Line 1147... |
Line 1147... |
static int warning_candidate_p (tree);
|
static int warning_candidate_p (tree);
|
static void warn_for_collisions (struct tlist *);
|
static void warn_for_collisions (struct tlist *);
|
static void warn_for_collisions_1 (tree, tree, struct tlist *, int);
|
static void warn_for_collisions_1 (tree, tree, struct tlist *, int);
|
static struct tlist *new_tlist (struct tlist *, tree, tree);
|
static struct tlist *new_tlist (struct tlist *, tree, tree);
|
|
|
|
#ifdef TARG_SL
|
|
static bool var_expr_equal(tree arg1, tree arg2)
|
|
{
|
|
if ((arg1 == NULL && arg2 != NULL)
|
|
|| (arg1 != NULL && arg2 == NULL))
|
|
return FALSE;
|
|
|
|
if (arg1 == arg2)
|
|
return TRUE;
|
|
|
|
enum tree_code code_1 = TREE_CODE (arg1);
|
|
enum tree_code code_2 = TREE_CODE (arg2);
|
|
|
|
if (code_1 != code_2)
|
|
return FALSE;
|
|
|
|
switch (code_1)
|
|
{
|
|
case VAR_DECL:
|
|
case PARM_DECL:
|
|
case FIELD_DECL:
|
|
return (arg1 == arg2);
|
|
case INDIRECT_REF:
|
|
return var_expr_equal (TREE_OPERAND (arg1, 0), TREE_OPERAND (arg2, 0));
|
|
case COMPONENT_REF:
|
|
return (var_expr_equal (TREE_OPERAND (arg1, 0), TREE_OPERAND (arg2, 0))
|
|
&& var_expr_equal (TREE_OPERAND (arg1, 1), TREE_OPERAND (arg2, 1)));
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* Get variable name */
|
|
static char * var_expr_name(tree var)
|
|
{
|
|
if (var == NULL) return NULL;
|
|
|
|
enum tree_code code = TREE_CODE (var);
|
|
|
|
switch (code)
|
|
{
|
|
case VAR_DECL:
|
|
case PARM_DECL:
|
|
case FIELD_DECL:
|
|
return (IDENTIFIER_POINTER (DECL_NAME (var)));
|
|
case INDIRECT_REF:
|
|
return (IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (var, 0))));
|
|
case COMPONENT_REF:
|
|
/* Just return the filed name */
|
|
return var_expr_name (TREE_OPERAND (var, 1));
|
|
default:
|
|
return NULL;
|
|
}
|
|
|
|
}
|
|
#endif
|
|
|
/* Create a new struct tlist and fill in its fields. */
|
/* Create a new struct tlist and fill in its fields. */
|
static struct tlist *
|
static struct tlist *
|
new_tlist (struct tlist *next, tree t, tree writer)
|
new_tlist (struct tlist *next, tree t, tree writer)
|
{
|
{
|
struct tlist *l;
|
struct tlist *l;
|
| Line 1197... |
Line 1254... |
int found = 0;
|
int found = 0;
|
struct tlist *tmp2;
|
struct tlist *tmp2;
|
struct tlist *next = add->next;
|
struct tlist *next = add->next;
|
|
|
for (tmp2 = *to; tmp2; tmp2 = tmp2->next)
|
for (tmp2 = *to; tmp2; tmp2 = tmp2->next)
|
|
#ifdef TARG_SL
|
|
if (var_expr_equal(tmp2->expr, add->expr))
|
|
#else
|
if (tmp2->expr == add->expr)
|
if (tmp2->expr == add->expr)
|
|
#endif
|
{
|
{
|
found = 1;
|
found = 1;
|
if (!tmp2->writer)
|
if (!tmp2->writer)
|
tmp2->writer = add->writer;
|
tmp2->writer = add->writer;
|
}
|
}
|
| Line 1225... |
Line 1286... |
{
|
{
|
struct tlist *tmp;
|
struct tlist *tmp;
|
|
|
/* Avoid duplicate warnings. */
|
/* Avoid duplicate warnings. */
|
for (tmp = warned_ids; tmp; tmp = tmp->next)
|
for (tmp = warned_ids; tmp; tmp = tmp->next)
|
|
#ifdef TARG_SL
|
|
if (var_expr_equal(tmp->expr, written))
|
|
#else
|
if (tmp->expr == written)
|
if (tmp->expr == written)
|
|
#endif
|
return;
|
return;
|
|
|
while (list)
|
while (list)
|
{
|
{
|
|
#ifdef TARG_SL
|
|
if (var_expr_equal(list->expr, written)
|
|
#else
|
if (list->expr == written
|
if (list->expr == written
|
|
#endif
|
&& list->writer != writer
|
&& list->writer != writer
|
&& (!only_writes || list->writer)
|
&& (!only_writes || list->writer)
|
&& DECL_NAME (list->expr))
|
&& DECL_NAME (list->expr))
|
{
|
{
|
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
|
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
|
|
#ifdef TARG_SL
|
|
if (TREE_CODE(list->expr) == GS_COMPONENT_REF)
|
|
error ("operation on structure field `%s' may be undefined",
|
|
var_expr_name (list->expr));
|
|
else
|
|
error ("operation on %qE may be undefined", list->expr);
|
|
#else
|
warning (0, "operation on %qE may be undefined", list->expr);
|
warning (0, "operation on %qE may be undefined", list->expr);
|
|
#endif
|
}
|
}
|
list = list->next;
|
list = list->next;
|
}
|
}
|
}
|
}
|
|
|
| Line 1262... |
Line 1339... |
/* Return nonzero if X is a tree that can be verified by the sequence point
|
/* Return nonzero if X is a tree that can be verified by the sequence point
|
warnings. */
|
warnings. */
|
static int
|
static int
|
warning_candidate_p (tree x)
|
warning_candidate_p (tree x)
|
{
|
{
|
|
#ifdef TARG_SL
|
|
/* Treat COMPONENT_REF as a whole */
|
|
return TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == PARM_DECL
|
|
|| TREE_CODE (x) == COMPONENT_REF;
|
|
#else
|
return TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == PARM_DECL;
|
return TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == PARM_DECL;
|
|
#endif
|
}
|
}
|
|
|
/* Walk the tree X, and record accesses to variables. If X is written by the
|
/* Walk the tree X, and record accesses to variables. If X is written by the
|
parent tree, WRITER is the parent.
|
parent tree, WRITER is the parent.
|
We store accesses in one of the two lists: PBEFORE_SP, and PNO_SP. If this
|
We store accesses in one of the two lists: PBEFORE_SP, and PNO_SP. If this
|