This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

more fortran test case(s)


Here are two more test cases provided for the intent of increasing our test suite coverage.  

I think one of them points to a defect, while using the flag -fno-range-check we are creating an integer divide with a result of NaaN to be an error.  real and complex in the same situation store the NaaN and go on.  If someone agrees (perhaps who uses the -fno-range-check compiler option), I would be happy to open up a PR and submit the rather trivial patch.

--bud davis


$ cat ./gcc/gcc/testsuite/gfortran.dg/arith_divide.f
! { dg-do compile }
! This test executes all code paths in gfc_arith_divide
! when executed along with it's companion test
! arith_divide_no_check.f
        implicit none
        integer i,j
        real a,b
        complex c,d
        i = 10/40
        j = 10/0! { dg-error "Division by zero at" }
        a = 10.0/40.0
        b = 10.0/0.0! { dg-error "Division by zero at" }
        c = (1.0,1.0)/(10.0,40.0) !  Not division by zero
        d = (1.0,10.)/(0.0,0.0)! { dg-error "Division by zero at" }
        end
 $ cat ./gcc/gcc/testsuite/gfortran.dg/arith_divide_no_check.f
! { dg-do compile }
! { dg-options "-fno-range-check" }
! This test executes all code paths in gfc_arith_divide
! when executed along with it's companion test
! arith_divide.f

        implicit none
        integer i,j
        real a,b
        complex c,d
        i = 10/40
        j = 10/0! { dg-error "Division by zero at" }
        a = 10.0/40.0
        b = 10.0/0.0
        c = (1.0,1.0)/(10.0,40.0)
        d = (1.0,10.)/(0.0,0.0)
        end
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]