]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/91485 (Erroneous conflict between variable x and operator(.x.))
authorSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 19 Aug 2019 03:21:46 +0000 (03:21 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 19 Aug 2019 03:21:46 +0000 (03:21 +0000)
2019-08-18  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91485
module.c (gfc_match_use): User defined operator cannot conflict with
a rename symbol.

2019-08-18  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91485
* gfortran.dg/pr91485.f90: New test.

From-SVN: r274632

gcc/fortran/ChangeLog
gcc/fortran/module.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr91485.f90 [new file with mode: 0644]

index 87eda46365b7728945958a83baf1798c3e8aaf3a..01ea2cddfe502427daa96f0b0c54bc4fa881b845 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-18  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91485
+       module.c (gfc_match_use): User defined operator cannot conflict with
+       a rename symbol.
+
 2019-08-17  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91471
index 569aad396f0c135bd1dca04237740f3fbd902a1f..dccce4fe0a45c765140acede4c83f3bfb22e4de1 100644 (file)
@@ -647,7 +647,7 @@ gfc_match_use (void)
            new_use->op = INTRINSIC_USER;
 
          st = gfc_find_symtree (gfc_current_ns->sym_root, name);
-         if (st)
+         if (st && type != INTERFACE_USER_OP)
            {
              if (m == MATCH_YES)
                gfc_error ("Symbol %qs at %L conflicts with the rename symbol "
index 4c944f8aa4787007f191135d6d850e86086659b4..2b6e142d4f7a8bf84abad6d8e5649a5ac46e13db 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-18  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91485
+       * gfortran.dg/pr91485.f90: New test.
+
 2019-08-17  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91471
diff --git a/gcc/testsuite/gfortran.dg/pr91485.f90 b/gcc/testsuite/gfortran.dg/pr91485.f90
new file mode 100644 (file)
index 0000000..a6d0687
--- /dev/null
@@ -0,0 +1,24 @@
+! { dg-do compile }
+module foo
+   implicit none
+   interface operator(.x.)
+      module procedure product
+   end interface operator(.x.)
+   contains
+      function product(x, y)
+         real, intent(in) :: x, y
+         real :: product
+         product = x * y
+      end function product
+end module foo
+
+module gfcbug155
+   implicit none
+   contains
+      subroutine print_prod (x, y)
+         use foo, only : operator(.x.)
+         implicit none
+         real :: x, y
+         print *, x .x. y
+      end subroutine print_prod
+end module gfcbug155