aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2019-06-14 18:17:00 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2019-06-14 18:17:00 +0000
commit3fa31ee92a75cb1afc321d7016c3c7ab28d7899c (patch)
treeffac84acec7fec47186b1550936332070e97cedd
parent957ed7386177e7d5da6b2908ec576906b784c892 (diff)
downloadgcc-3fa31ee92a75cb1afc321d7016c3c7ab28d7899c.zip
gcc-3fa31ee92a75cb1afc321d7016c3c7ab28d7899c.tar.gz
gcc-3fa31ee92a75cb1afc321d7016c3c7ab28d7899c.tar.bz2
re PR fortran/89646 (Spurious actual argument might interfere warning)
2019-06-14 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/89646 * dependency.c (gfc_check_argument_var_dependency): Suppress spurious warnings by comparing variable names. 2019-06-14 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/89646 * gfortran.dg/pr89646.f90: New test. From-SVN: r272307
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/dependency.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr89646.f9024
4 files changed, 44 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 99a399a..9a82b9b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,4 +1,10 @@
-2019-06-12 Steven G. Kargl <kargl@gcc.gnu.org>
+2019-06-14 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/89646
+ * dependency.c (gfc_check_argument_var_dependency): Suppress spurious
+ warnings by comparing variable names.
+
+2019-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68544
* resolve.c (is_dt_name): New function to compare symbol name against
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 8eae644..be330e2 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -979,10 +979,14 @@ gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent,
If a dependency is found in the case
elemental == ELEM_CHECK_VARIABLE, we will generate
a temporary, so we don't need to bother the user. */
- gfc_warning (0, "INTENT(%s) actual argument at %L might "
- "interfere with actual argument at %L.",
- intent == INTENT_OUT ? "OUT" : "INOUT",
- &var->where, &expr->where);
+
+ if (var->expr_type == EXPR_VARIABLE
+ && expr->expr_type == EXPR_VARIABLE
+ && strcmp(var->symtree->name, expr->symtree->name) == 0)
+ gfc_warning (0, "INTENT(%s) actual argument at %L might "
+ "interfere with actual argument at %L.",
+ intent == INTENT_OUT ? "OUT" : "INOUT",
+ &var->where, &expr->where);
}
return 0;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3d64fb0..8ab6cb4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-14 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/89646
+ * gfortran.dg/pr89646.f90: New test.
+
2019-06-14 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/90765
diff --git a/gcc/testsuite/gfortran.dg/pr89646.f90 b/gcc/testsuite/gfortran.dg/pr89646.f90
new file mode 100644
index 0000000..c348020
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr89646.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! PR fortran/89646
+! Original testcase contributed by Ian Harvey <ian_harvey at bigpond dot com>
+!
+! This code use to give spurious warnings about aliasing.
+!
+module m
+ implicit none
+ type :: t
+ end type t
+ contains
+ ! To reproduce, both actual arguments must be TARGET,
+ ! both arguments must be of derived type.
+ subroutine s
+ type(t), target :: a(5)
+ type(t), target :: b(5)
+ call move(a, b)
+ end subroutine s
+ ! To reproduce, called procedure must be elemental.
+ elemental subroutine move(x, y)
+ type(t), intent(inout) :: x
+ type(t), intent(out) :: y
+ end subroutine move
+end module m