Patchwork [libquadmath,committed] Fix exponent reading

login
register
mail settings
Submitter Tobias Burnus
Date Dec. 4, 2012, 4:44 p.m.
Message ID <50BE2866.2090601@net-b.de>
Download mbox | patch
Permalink /patch/203687/
State New
Headers show

Comments

Tobias Burnus - Dec. 4, 2012, 4:44 p.m.
David Edelsohn wrote:
> I have not tried this patch, but will it actually fix it?  The error
> is real_kinds(3) is outside the array bounds. Your patch fixes
> addresses a runtime problem, not a compile-time problem, if I
> understand correctly.

Yes, I realized it myself - after a hint by Dominique. The following 
should fix it. I really shouldn't try to quickly fix such bugs while 
working on something else :-(

Tobias

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(Revision 194155)
+++ ChangeLog	(Arbeitskopie)
@@ -1,5 +1,9 @@ 
 2012-12-04  Tobias Burnus  <burnus@net-b.de>
 
+	* gfortran.dg/quad_3.f90: Really fix an if condition.
+
+2012-12-04  Tobias Burnus  <burnus@net-b.de>
+
 	* gfortran.dg/quad_3.f90: Fix a condition,
 	which wrongly required ordered/lazy evaluation.
 
Index: gfortran.dg/quad_3.f90
===================================================================
--- gfortran.dg/quad_3.f90	(Revision 194155)
+++ gfortran.dg/quad_3.f90	(Arbeitskopie)
@@ -9,13 +9,14 @@  program test_qp
    implicit none
    integer, parameter :: QP = real_kinds(ubound(real_kinds,dim=1))
    real(kind=qp) :: a,b(2), c
-   integer :: exponent
+   integer :: exponent, i
    character(len=180) :: tmp
 
    ! Run this only with libquadmath; assume that all those systems
    ! have also kind=10.
-   if (size (real_kinds) >= 4 .and. real_kinds(3) == 10 .and. qp == 16) then
-     if (real_kinds(3) /= 10) stop
+   if (size (real_kinds) >= 4 .and. qp == 16) then
+     i = 3
+     if (real_kinds(i) /= 10) stop
 
      exponent = 4000
      b(:) = huge (1.0_qp)/10.0_qp**exponent