diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-04 23:34:06 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-04 23:34:06 +0000 |
commit | e60fa8e9069a907f7b9110531ab444cd8c412bd9 (patch) | |
tree | 729c397263390e58a1e0056350bf2b1959af7c43 | |
parent | 0810ff536895c36702169eaea2d8ed104448e16f (diff) | |
download | gcc-e60fa8e9069a907f7b9110531ab444cd8c412bd9.tar.gz |
gcc/java
PR java/25676:
* builtins.c (max_builtin): Skip floating point 'max'.
(min_builtin): Skip floating point 'min'.
(check_for_builtin): Never return NULL_TREE.
libjava
PR java/25676:
* testsuite/libjava.lang/pr25676.out: New file.
* testsuite/libjava.lang/pr25676.java: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110599 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/builtins.c | 18 | ||||
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/pr25676.java | 12 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/pr25676.out | 2 |
5 files changed, 41 insertions, 4 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index bce385b4845..5d2515ace3f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,5 +1,12 @@ 2006-02-04 Tom Tromey <tromey@redhat.com> + PR java/25676: + * builtins.c (max_builtin): Skip floating point 'max'. + (min_builtin): Skip floating point 'min'. + (check_for_builtin): Never return NULL_TREE. + +2006-02-04 Tom Tromey <tromey@redhat.com> + PR java/26097: * expr.c (push_type): Avoid side effect in gcc_assert. diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index ff6da981a0e..5082cd02afc 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -1,5 +1,5 @@ /* Built-in and inline functions for gcj - Copyright (C) 2001, 2003, 2004, 2005 + Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GCC. @@ -94,6 +94,9 @@ static GTY(()) struct builtin_record java_builtins[] = static tree max_builtin (tree method_return_type, tree method_arguments) { + /* MAX_EXPR does not handle -0.0 in the Java style. */ + if (TREE_CODE (method_return_type) == REAL_TYPE) + return NULL_TREE; return fold_build2 (MAX_EXPR, method_return_type, TREE_VALUE (method_arguments), TREE_VALUE (TREE_CHAIN (method_arguments))); @@ -102,6 +105,9 @@ max_builtin (tree method_return_type, tree method_arguments) static tree min_builtin (tree method_return_type, tree method_arguments) { + /* MIN_EXPR does not handle -0.0 in the Java style. */ + if (TREE_CODE (method_return_type) == REAL_TYPE) + return NULL_TREE; return fold_build2 (MIN_EXPR, method_return_type, TREE_VALUE (method_arguments), TREE_VALUE (TREE_CHAIN (method_arguments))); @@ -265,11 +271,15 @@ check_for_builtin (tree method, tree call) tree fn; if (java_builtins[i].creator != NULL) - return (*java_builtins[i].creator) (method_return_type, - method_arguments); + { + tree result + = (*java_builtins[i].creator) (method_return_type, + method_arguments); + return result == NULL_TREE ? call : result; + } fn = built_in_decls[java_builtins[i].builtin_code]; if (fn == NULL_TREE) - return NULL_TREE; + return call; return java_build_function_call_expr (fn, method_arguments); } } diff --git a/libjava/ChangeLog b/libjava/ChangeLog index bdb0a89adab..970d975a1e8 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2006-02-04 Tom Tromey <tromey@redhat.com> + + PR java/25676: + * testsuite/libjava.lang/pr25676.out: New file. + * testsuite/libjava.lang/pr25676.java: New file. + 2006-02-03 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (src.zip): Update src.zip file search to look in diff --git a/libjava/testsuite/libjava.lang/pr25676.java b/libjava/testsuite/libjava.lang/pr25676.java new file mode 100644 index 00000000000..e79a2c23d91 --- /dev/null +++ b/libjava/testsuite/libjava.lang/pr25676.java @@ -0,0 +1,12 @@ +public class pr25676 +{ + public static double g(double a, double b) + { + return Math.min(a, b); + } + public static void main(String a[]) + { + System.out.println (g(0.0, -0.0)); + System.out.println (g(-0.0, 0.0)); + } +} diff --git a/libjava/testsuite/libjava.lang/pr25676.out b/libjava/testsuite/libjava.lang/pr25676.out new file mode 100644 index 00000000000..e6ffe0d430b --- /dev/null +++ b/libjava/testsuite/libjava.lang/pr25676.out @@ -0,0 +1,2 @@ +-0.0 +-0.0 |