diff options
author | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-08 18:10:54 +0000 |
---|---|---|
committer | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-08 18:10:54 +0000 |
commit | 962e6e5a5d712ebaa238c7c296447bd2afac8dd1 (patch) | |
tree | 4a0b49aa184659d74cfe8086a19ee61b887b1d67 /gcc/java | |
parent | 028f8cc7142ff9e1778f852559dfa1bf770a06c3 (diff) | |
download | gcc-962e6e5a5d712ebaa238c7c296447bd2afac8dd1.tar.gz |
��> 2003-06-07�� Anthony Green�� <green@redhat.com>
��>
��>������������* parse.y (patch_cast): Fix conversions from floating-point to
��>������������integral types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/parse.y | 13 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 7253429d127..23bc14bbc7f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2003-06-08 Anthony Green <green@redhat.com> + + * parse.y (patch_cast): Fix conversions from floating-point to + integral types. + 2003-06-08 Neil Booth <neil@daikokuya.co.uk> * Make-lang.in: Update. diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 62b796f6879..88c8c31978a 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -14224,14 +14224,15 @@ patch_cast (tree node, tree wfl_op) if (cast_type == op_type) return node; - /* float and double type are converted to the original type main - variant and then to the target type. */ - if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE) - op = convert (integer_type_node, op); + /* A narrowing conversion from a floating-point number to an + integral type requires special handling (5.1.3). */ + if (JFLOAT_TYPE_P (op_type) && JINTEGRAL_TYPE_P (cast_type)) + if (cast_type != long_type_node) + op = convert (integer_type_node, op); - /* Try widening/narowwing convertion. Potentially, things need + /* Try widening/narrowing convertion. Potentially, things need to be worked out in gcc so we implement the extreme cases - correctly. fold_convert() needs to be fixed. */ + correctly. fold_convert() needs to be fixed. */ return convert (cast_type, op); } |