aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Wang <fengwang@gcc.gnu.org>2005-06-24 03:23:04 +0000
committerFeng Wang <fengwang@gcc.gnu.org>2005-06-24 03:23:04 +0000
commita3504e64abf8db7b538c95d5a10890c21c22b28f (patch)
treea35309ed7895a855626c6b72c80455f9d5e29992
parentb8807f054bddc0e4014e5879f0fac331cc1a7768 (diff)
downloadgcc-a3504e64abf8db7b538c95d5a10890c21c22b28f.zip
gcc-a3504e64abf8db7b538c95d5a10890c21c22b28f.tar.gz
gcc-a3504e64abf8db7b538c95d5a10890c21c22b28f.tar.bz2
simplify.c (gfc_simplify_modulo): Don't clear before get result.
2005-06-24 Feng Wang <fengwang@nudt.edu.cn> * simplify.c (gfc_simplify_modulo): Don't clear before get result. 2005-06-24 Feng Wang <fengwang@nudt.edu.cn> * gfortran.dg/simplify_modulo.f90: New. From-SVN: r101288
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/simplify.c3
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/simplify_modulo.f905
4 files changed, 15 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4badf66..99a232e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,4 +1,8 @@
-2005-06-22 Paul Brook <paul@codesourcery.com>
+2005-06-24 Feng Wang <fengwang@nudt.edu.cn>
+
+ * simplify.c (gfc_simplify_modulo): Don't clear before get result.
+
+2005-06-22 Paul Brook <paul@codesourcery.com>
PR fortran/21034
* symbol.c (gfc_is_var_automatic): New function.
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 6797bca..fc3a9cb 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -2231,12 +2231,11 @@ gfc_simplify_modulo (gfc_expr * a, gfc_expr * p)
mpfr_div (quot, a->value.real, p->value.real, GFC_RND_MODE);
mpfr_floor (iquot, quot);
mpfr_mul (term, iquot, p->value.real, GFC_RND_MODE);
+ mpfr_sub (result->value.real, a->value.real, term, GFC_RND_MODE);
mpfr_clear (quot);
mpfr_clear (iquot);
mpfr_clear (term);
-
- mpfr_sub (result->value.real, a->value.real, term, GFC_RND_MODE);
break;
default:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b96fc11..413f381 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-06-24 Feng Wang <fengwang@nudt.edu.cn>
+
+ * gfortran.dg/simplify_modulo.f90: New.
+
2005-06-24 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/20040210-1.c: Fix for unit-at-a-time
diff --git a/gcc/testsuite/gfortran.dg/simplify_modulo.f90 b/gcc/testsuite/gfortran.dg/simplify_modulo.f90
new file mode 100644
index 0000000..550a3ad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/simplify_modulo.f90
@@ -0,0 +1,5 @@
+! { dg-do run }
+
+if (modulo (-8., -5.) .ne. -3.) call abort ()
+
+end