Fortran : ICE in maybe_canonicalize_comparison_1 PR92993
authorMark Eggleston <markeggleston@gcc.gnu.org>
Thu, 4 Jun 2020 04:53:31 +0000 (05:53 +0100)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Mon, 8 Jun 2020 10:17:40 +0000 (11:17 +0100)
This issue has been fixed by PR94090.  Add test case to ensure that
this does not re-occur.

2020-06-08  Mark Eggleston  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/92993
* gfortran.dg/pr92993.f90: New test.

gcc/testsuite/gfortran.dg/pr92993.f90 [new file with mode: 0644]

diff --git a/gcc/testsuite/gfortran.dg/pr92993.f90 b/gcc/testsuite/gfortran.dg/pr92993.f90
new file mode 100644 (file)
index 0000000..b733553
--- /dev/null
@@ -0,0 +1,21 @@
+! { dg-do compile }
+!
+! Original by G. Steinmetz
+
+function f(x)
+  integer, intent(in) :: x
+  integer :: f
+  f = x
+end
+
+program p
+  interface
+    function f(x) ! { dg-error "POINTER attribute mismatch in function result" }
+      integer, intent(in) :: x
+      integer, pointer :: f
+    end
+  end interface
+  integer :: a(2) = [1, 2]
+  if ( a(2) .ne. f(a(2)) ) stop 1
+end
+