diff options
author | domob <domob@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-11 07:28:18 +0000 |
---|---|---|
committer | domob <domob@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-11 07:28:18 +0000 |
commit | 96efe7138202a220c3f6168a4e7f3fc9f4e93a83 (patch) | |
tree | 4d02a9e80e0692269de3441e8f5312c2554431ee | |
parent | 669bfbb465506da43433215cda027221279a8e87 (diff) | |
download | gcc-96efe7138202a220c3f6168a4e7f3fc9f4e93a83.tar.gz |
2008-09-11 Daniel Kraft <d@domob.eu>
PR fortran/36214
* simplify.c (simplify_cmplx): Added linebreak to long line.
* target-memory.c (gfc_convert_boz): Fix indentation.
(gfc_interpret_float): Set mpfr precision to right value before
calling mpfr_init.
2008-09-11 Daniel Kraft <d@domob.eu>
PR fortran/36214
* gfortran.dg/boz_9.f90: Corrected test.
* gfortran.dg/boz_13.f90: New test.
* gfortran.dg/boz_14.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140264 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/simplify.c | 3 | ||||
-rw-r--r-- | gcc/fortran/target-memory.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/boz_13.f90 | 13 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/boz_14.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/boz_9.f90 | 6 |
7 files changed, 55 insertions, 9 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d7361e02f7b..954d5cdb6ea 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2008-09-11 Daniel Kraft <d@domob.eu> + + PR fortran/36214 + * simplify.c (simplify_cmplx): Added linebreak to long line. + * target-memory.c (gfc_convert_boz): Fix indentation. + (gfc_interpret_float): Set mpfr precision to right value before + calling mpfr_init. + 2008-09-10 H.J. Lu <hongjiu.lu@intel.com> * expr.c (find_array_element): Reformat comment. diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 64d2be190f9..c0ac0262050 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -884,7 +884,8 @@ simplify_cmplx (const char *name, gfc_expr *x, gfc_expr *y, int kind) { case BT_INTEGER: if (!y->is_boz) - mpfr_set_z (result->value.complex.i, y->value.integer, GFC_RND_MODE); + mpfr_set_z (result->value.complex.i, y->value.integer, + GFC_RND_MODE); break; case BT_REAL: diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c index b1029dfa5dc..72bd6eff214 100644 --- a/gcc/fortran/target-memory.c +++ b/gcc/fortran/target-memory.c @@ -349,8 +349,9 @@ gfc_interpret_integer (int kind, unsigned char *buffer, size_t buffer_size, int gfc_interpret_float (int kind, unsigned char *buffer, size_t buffer_size, - mpfr_t real) + mpfr_t real) { + gfc_set_model_kind (kind); mpfr_init (real); gfc_conv_tree_to_mpfr (real, native_interpret_expr (gfc_get_real_type (kind), @@ -699,10 +700,8 @@ gfc_convert_boz (gfc_expr *expr, gfc_typespec *ts) } for (index = 0; gfc_integer_kinds[index].kind != 0; ++index) - { - if ((unsigned) gfc_integer_kinds[index].bit_size >= ts_bit_size) - break; - } + if ((unsigned) gfc_integer_kinds[index].bit_size >= ts_bit_size) + break; expr->ts.kind = gfc_integer_kinds[index].kind; buffer_size = MAX (buffer_size, size_integer (expr->ts.kind)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 88463e9b491..b42b5dfc2ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2008-09-11 Daniel Kraft <d@domob.eu> + + PR fortran/36214 + * gfortran.dg/boz_9.f90: Corrected test. + * gfortran.dg/boz_13.f90: New test. + * gfortran.dg/boz_14.f90: New test. + 2008-09-10 Jakub Jelinek <jakub@redhat.com> PR target/36904 diff --git a/gcc/testsuite/gfortran.dg/boz_13.f90 b/gcc/testsuite/gfortran.dg/boz_13.f90 new file mode 100644 index 00000000000..a522f82ec87 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_13.f90 @@ -0,0 +1,13 @@ +! { dg-do run } + +! PR fortran/36214 +! For BOZ-initialization of floats, the precision used to be wrong sometimes. + +implicit none + real, parameter :: r = 0.0 + real(kind=8), parameter :: rd = real (z'00000000& + &402953FD', 8) + + if (real (z'00000000& + &402953FD', 8) /= rd) call abort +end diff --git a/gcc/testsuite/gfortran.dg/boz_14.f90 b/gcc/testsuite/gfortran.dg/boz_14.f90 new file mode 100644 index 00000000000..a6690ce9f9d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_14.f90 @@ -0,0 +1,18 @@ +! { dg-do run } + +! PR fortran/36214 +! For BOZ-initialization of floats, the precision used to be wrong sometimes. + + implicit none + real(4) r + real(8) rd + complex(8) z + rd = & + real (b'00000000000000000000000000000000& + &01000000001010010101001111111101',8) + z = & + cmplx(b'00000000000000000000000000000000& + &01000000001010010101001111111101',0,8) + r = 0. + if (z /= rd) call abort + end diff --git a/gcc/testsuite/gfortran.dg/boz_9.f90 b/gcc/testsuite/gfortran.dg/boz_9.f90 index e1b0592e67a..1488c6dc8be 100644 --- a/gcc/testsuite/gfortran.dg/boz_9.f90 +++ b/gcc/testsuite/gfortran.dg/boz_9.f90 @@ -22,13 +22,13 @@ complex :: z2 = cmplx(5.0, o'01245') if (r2c /= 13107.0) call abort() if (rc /= 1.83668190E-41) call abort() -if (dc /= 0.30102999566398120) call abort() +if (dc /= 0.30102999566398120d0) call abort() if (real(z1c) /= 2.94272678E-44 .or. aimag(z1c) /= -4.0) call abort() if (real(z2c) /= 5.0 .or. aimag(z2c) /= 9.48679060E-43) call abort() if (r2 /= 13107.0) call abort() if (r /= 1.83668190E-41) call abort() -if (d /= 0.30102999566398120) call abort() +if (d /= 0.30102999566398120d0) call abort() if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort() if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort() @@ -40,7 +40,7 @@ z2 = cmplx(5.0, o'01245') if (r2 /= 13107.0) call abort() if (r /= 1.83668190E-41) call abort() -if (d /= 0.30102999566398120) call abort() +if (d /= 0.30102999566398120d0) call abort() if (real(z1) /= 2.94272678E-44 .or. aimag(z1) /= -4.0) call abort() if (real(z2) /= 5.0 .or. aimag(z2) /= 9.48679060E-43) call abort() |