summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2019-08-19 03:00:54 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2019-08-19 03:00:54 +0000
commit88898d1e1ec4e2240b52818cef4981dd85585a31 (patch)
tree56ebc1bc0f11c30ffc592891e099f0efbd8dac06
parente00f86581f977cc6ad5ac9558a83f569aba76772 (diff)
re PR fortran/91485 (Erroneous conflict between variable x and operator(.x.))
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: r274630
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/module.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr91485.f9024
4 files changed, 36 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 9af58369cc1..8cca6179eb8 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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/82992
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index fb6173dcde3..533445e2655 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -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 "
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0eb47a644b2..dc44897e743 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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/82992
diff --git a/gcc/testsuite/gfortran.dg/pr91485.f90 b/gcc/testsuite/gfortran.dg/pr91485.f90
new file mode 100644
index 00000000000..a6d06877e85
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr91485.f90
@@ -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