From 840ab4e2501e4782c336958058bc48cf2c20069a Mon Sep 17 00:00:00 2001 From: fxcoudert Date: Thu, 3 Jul 2014 11:47:46 +0000 Subject: [PATCH] * gfortran.dg/ieee/ieee_1.F90: Mark variables as volatile to avoid optimization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212261 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 | 29 ++--------------------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 58dd47b29ca..886a964b52d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-03 Francois-Xavier Coudert + + * gfortran.dg/ieee/ieee_1.F90: Mark variables as volatile to + avoid optimization. + 2014-07-03 Zhenqiang Chen * gcc.target/arm/identical-invariants.c: New test. diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 b/gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 index 5c1a0619887..329aeef0d44 100644 --- a/gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 +++ b/gcc/testsuite/gfortran.dg/ieee/ieee_1.F90 @@ -11,10 +11,6 @@ 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(" ") @@ -61,13 +55,11 @@ 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 @@ -102,9 +93,7 @@ ! 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(" ") @@ -114,13 +103,11 @@ 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,& @@ -134,7 +121,6 @@ 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 -- 2.11.4.GIT