aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Kargl <sgk@troutmask.apl.washington.edu>2021-02-12 07:58:16 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2021-02-12 07:58:16 -0800
commit0631e008adc759cc801d0d034224ee6b4bcf31aa (patch)
treec96b1b4067b287dd13c516319c7f38e1b55e5508 /gcc
parentadfee3c4c03dd70a06f6283178d7943b09652206 (diff)
downloadgcc-0631e008adc759cc801d0d034224ee6b4bcf31aa.zip
gcc-0631e008adc759cc801d0d034224ee6b4bcf31aa.tar.gz
gcc-0631e008adc759cc801d0d034224ee6b4bcf31aa.tar.bz2
libgfortran: Fix PR95647 by changing the interfaces of operators .eq. and .ne.
The FE converts the old school .eq. to ==, and then tracks the ==. The module starts with == and so it does not properly overload the .eq. Reversing the interfaces fixes this. 2021-02-12 Steve Kargl <sgk@troutmask.apl.washington.edu> libgfortran/ChangeLog: PR libfortran/95647 * ieee/ieee_arithmetic.F90: Flip interfaces of operators .eq. to == and .ne. to /= . gcc/testsuite/ChangeLog: PR libfortran/95647 * gfortran.dg/ieee/ieee_12.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/ieee/ieee_12.f9024
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_12.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_12.f90
new file mode 100644
index 0000000..139a701
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ieee/ieee_12.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! PR95647 operator(.eq.) and operator(==) treated differently
+program test
+ use, intrinsic :: ieee_arithmetic, only : &
+& ieee_class, &
+& ieee_class_type, &
+& ieee_negative_normal, &
+& ieee_positive_normal, &
+& operator(.eq.), operator(.ne.)
+ integer :: good
+ real(4) r4
+ type(ieee_class_type) class1
+ good = 0
+ r4 = 1.0
+ class1 = ieee_class(r4)
+ if (class1 .eq. ieee_positive_normal) good = good + 1
+ if (class1 .ne. ieee_negative_normal) good = good + 1
+ r4 = -1.0
+ class1 = ieee_class(r4)
+ if (class1 .eq. ieee_negative_normal) good = good + 1
+ if (class1 .ne. ieee_positive_normal) good = good + 1
+ if (good /= 4) call abort
+end program test
+