re PR java/25676 (Use of MIN_EXPR/MAX_EXPR is wrong for java)
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. From-SVN: r110599
This commit is contained in:
parent
fb579387f9
commit
05d8200d79
5 changed files with 41 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
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>
|
2006-02-04 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
PR java/26097:
|
PR java/26097:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Built-in and inline functions for gcj
|
/* Built-in and inline functions for gcj
|
||||||
Copyright (C) 2001, 2003, 2004, 2005
|
Copyright (C) 2001, 2003, 2004, 2005, 2006
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GCC.
|
This file is part of GCC.
|
||||||
|
@ -94,6 +94,9 @@ static GTY(()) struct builtin_record java_builtins[] =
|
||||||
static tree
|
static tree
|
||||||
max_builtin (tree method_return_type, tree method_arguments)
|
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,
|
return fold_build2 (MAX_EXPR, method_return_type,
|
||||||
TREE_VALUE (method_arguments),
|
TREE_VALUE (method_arguments),
|
||||||
TREE_VALUE (TREE_CHAIN (method_arguments)));
|
TREE_VALUE (TREE_CHAIN (method_arguments)));
|
||||||
|
@ -102,6 +105,9 @@ max_builtin (tree method_return_type, tree method_arguments)
|
||||||
static tree
|
static tree
|
||||||
min_builtin (tree method_return_type, tree method_arguments)
|
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,
|
return fold_build2 (MIN_EXPR, method_return_type,
|
||||||
TREE_VALUE (method_arguments),
|
TREE_VALUE (method_arguments),
|
||||||
TREE_VALUE (TREE_CHAIN (method_arguments)));
|
TREE_VALUE (TREE_CHAIN (method_arguments)));
|
||||||
|
@ -265,11 +271,15 @@ check_for_builtin (tree method, tree call)
|
||||||
tree fn;
|
tree fn;
|
||||||
|
|
||||||
if (java_builtins[i].creator != NULL)
|
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];
|
fn = built_in_decls[java_builtins[i].builtin_code];
|
||||||
if (fn == NULL_TREE)
|
if (fn == NULL_TREE)
|
||||||
return NULL_TREE;
|
return call;
|
||||||
return java_build_function_call_expr (fn, method_arguments);
|
return java_build_function_call_expr (fn, method_arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
2006-02-03 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||||
|
|
||||||
* Makefile.am (src.zip): Update src.zip file search to look in
|
* Makefile.am (src.zip): Update src.zip file search to look in
|
||||||
|
|
12
libjava/testsuite/libjava.lang/pr25676.java
Normal file
12
libjava/testsuite/libjava.lang/pr25676.java
Normal file
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
2
libjava/testsuite/libjava.lang/pr25676.out
Normal file
2
libjava/testsuite/libjava.lang/pr25676.out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
-0.0
|
||||||
|
-0.0
|
Loading…
Add table
Reference in a new issue