]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ieee_1.F90: Mark variables as volatile to avoid optimization.
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Thu, 3 Jul 2014 11:47:46 +0000 (11:47 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Thu, 3 Jul 2014 11:47:46 +0000 (11:47 +0000)
* gfortran.dg/ieee/ieee_1.F90: Mark variables as volatile to
avoid optimization.

From-SVN: r212261

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/ieee/ieee_1.F90

index 58dd47b29ca53fc750eea707d81b426d5f2f8019..886a964b52d00ca14d18437545f7c428a3dabfeb 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-03  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       * gfortran.dg/ieee/ieee_1.F90: Mark variables as volatile to
+       avoid optimization.
+
 2014-07-03  Zhenqiang Chen  <zhenqiang.chen@linaro.org>
 
        * gcc.target/arm/identical-invariants.c: New test.
index 5c1a061988776aa670f944d5509d28a019cd3377..329aeef0d4461d2b6dbfb0ecf29a8004c3c0883a 100644 (file)
 
   implicit none
 
-  interface use_real
-    procedure use_real_4, use_real_8
-  end interface use_real
-
   type(ieee_flag_type), parameter :: x(5) = &
     [ IEEE_INVALID, IEEE_OVERFLOW, IEEE_DIVIDE_BY_ZERO, &
       IEEE_UNDERFLOW, IEEE_INEXACT ]
@@ -33,8 +29,8 @@
   end if ; \
   call check_flag_sub
 
-  real :: sx
-  double precision :: dx
+  real, volatile :: sx
+  double precision, volatile :: dx
 
   ! This file tests IEEE_SET_FLAG and IEEE_GET_FLAG
 
@@ -49,9 +45,7 @@
 
   ! Raise invalid, then clear
   sx = -1
-  call use_real(sx)
   sx = sqrt(sx)
-  call use_real(sx)
   CHECK_FLAGS("I    ")
   call ieee_set_flag(ieee_all, .false.)
   CHECK_FLAGS("     ")
   CHECK_FLAGS("     ")
   sx = sx*sx
   CHECK_FLAGS(" O  P")
-  call use_real(sx)
 
   ! Also raise divide-by-zero
   sx = 0
   sx = 1 / sx
   CHECK_FLAGS(" OZ P")
-  call use_real(sx)
 
   ! Clear them
   call ieee_set_flag([ieee_overflow,ieee_inexact,&
@@ -80,7 +72,6 @@
   sx = tiny(sx)
   CHECK_FLAGS("     ")
   sx = sx / 10
-  call use_real(sx)
   CHECK_FLAGS("   UP")
 
   ! Raise everything
 
   ! Raise invalid, then clear
   dx = -1
-  call use_real(dx)
   dx = sqrt(dx)
-  call use_real(dx)
   CHECK_FLAGS("I    ")
   call ieee_set_flag(ieee_all, .false.)
   CHECK_FLAGS("     ")
   CHECK_FLAGS("     ")
   dx = dx*dx
   CHECK_FLAGS(" O  P")
-  call use_real(dx)
 
   ! Also raise divide-by-zero
   dx = 0
   dx = 1 / dx
   CHECK_FLAGS(" OZ P")
-  call use_real(dx)
 
   ! Clear them
   call ieee_set_flag([ieee_overflow,ieee_inexact,&
   CHECK_FLAGS("     ")
   dx = dx / 10
   CHECK_FLAGS("   UP")
-  call use_real(dx)
 
   ! Raise everything
   call ieee_set_flag(ieee_all, .true.)
@@ -160,15 +146,4 @@ contains
     end if
   end subroutine
 
-  ! Interface to a routine that avoids calculations to be optimized out,
-  ! making it appear that we use the result
-  subroutine use_real_4(x)
-    real :: x
-    if (x == 123456.789) print *, "toto"
-  end subroutine
-  subroutine use_real_8(x)
-    double precision :: x
-    if (x == 123456.789) print *, "toto"
-  end subroutine
-
 end