parse.y (fold_constant_for_init): If a VAR_DECL, convert numerical constant to the type of the field.
2002-09-11 Per Bothner <per@bothner.com> * parse.y (fold_constant_for_init): If a VAR_DECL, convert numerical constant to the type of the field. (java_complete_tree): Remove now-redundant code. * parse.y (fold_constant_for_init): 'null' is not a constant expr. From-SVN: r57036
This commit is contained in:
parent
23114b697a
commit
6e471ea7b8
2 changed files with 15 additions and 16 deletions
|
@ -1,3 +1,11 @@
|
|||
2002-09-11 Per Bothner <per@bothner.com>
|
||||
|
||||
* parse.y (fold_constant_for_init): If a VAR_DECL, convert numerical
|
||||
constant to the type of the field.
|
||||
(java_complete_tree): Remove now-redundant code.
|
||||
|
||||
* parse.y (fold_constant_for_init): 'null' is not a constant expr.
|
||||
|
||||
2002-09-03 Jesse Rosenstock <jmr@ugcs.caltech.edu>
|
||||
|
||||
For PR java/5794:
|
||||
|
|
|
@ -11509,22 +11509,9 @@ java_complete_tree (node)
|
|||
&& DECL_INITIAL (node) != NULL_TREE
|
||||
&& !flag_emit_xref)
|
||||
{
|
||||
tree value = DECL_INITIAL (node);
|
||||
DECL_INITIAL (node) = NULL_TREE;
|
||||
value = fold_constant_for_init (value, node);
|
||||
DECL_INITIAL (node) = value;
|
||||
tree value = fold_constant_for_init (node, node);
|
||||
if (value != NULL_TREE)
|
||||
{
|
||||
/* fold_constant_for_init sometimes widens the original type
|
||||
of the constant (i.e. byte to int). It's not desirable,
|
||||
especially if NODE is a function argument. */
|
||||
if ((TREE_CODE (value) == INTEGER_CST
|
||||
|| TREE_CODE (value) == REAL_CST)
|
||||
&& TREE_TYPE (node) != TREE_TYPE (value))
|
||||
return convert (TREE_TYPE (node), value);
|
||||
else
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
@ -16010,8 +15997,10 @@ fold_constant_for_init (node, context)
|
|||
|
||||
switch (code)
|
||||
{
|
||||
case STRING_CST:
|
||||
case INTEGER_CST:
|
||||
if (node == null_pointer_node)
|
||||
return NULL_TREE;
|
||||
case STRING_CST:
|
||||
case REAL_CST:
|
||||
return node;
|
||||
|
||||
|
@ -16084,6 +16073,8 @@ fold_constant_for_init (node, context)
|
|||
/* Guard against infinite recursion. */
|
||||
DECL_INITIAL (node) = NULL_TREE;
|
||||
val = fold_constant_for_init (val, node);
|
||||
if (val != NULL_TREE && TREE_CODE (val) != STRING_CST)
|
||||
val = try_builtin_assignconv (NULL_TREE, TREE_TYPE (node), val);
|
||||
DECL_INITIAL (node) = val;
|
||||
return val;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue