aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2009-02-26 18:43:50 +0000
committerPaul Thomas <pault@gcc.gnu.org>2009-02-26 18:43:50 +0000
commit489ec4e3bd232d184845a5b71322dfe18e65529f (patch)
treed310ef8eaa5e71425a136cec8058b82462b5febc /gcc/fortran
parentebb9cc41a88a3db8ebf141e15cf4fe2a094cb262 (diff)
downloadgcc-489ec4e3bd232d184845a5b71322dfe18e65529f.zip
gcc-489ec4e3bd232d184845a5b71322dfe18e65529f.tar.gz
gcc-489ec4e3bd232d184845a5b71322dfe18e65529f.tar.bz2
re PR fortran/39295 (Too strict interface conformance check)
2009-02-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/39295 * interface.c (compare_type_rank_if): Return 1 if the symbols are the same and deal with external procedures where one is identified to be a function or subroutine by usage but the other is not. 2009-02-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/39295 * gfortran.dg/interface_25.f90: New test. * gfortran.dg/interface_26.f90: New test. From-SVN: r144449
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/interface.c17
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 859e423..4bf4625 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,13 @@
2009-02-26 Paul Thomas <pault@gcc.gnu.org>
+ PR fortran/39295
+ * interface.c (compare_type_rank_if): Return 1 if the symbols
+ are the same and deal with external procedures where one is
+ identified to be a function or subroutine by usage but the
+ other is not.
+
+2009-02-26 Paul Thomas <pault@gcc.gnu.org>
+
PR fortran/39292
* trans-array.c (gfc_conv_array_initializer): Convert all
expressions rather than ICEing.
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 5b2bdd1..88638070 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -491,17 +491,26 @@ compare_type_rank_if (gfc_symbol *s1, gfc_symbol *s2)
if (s1 == NULL || s2 == NULL)
return s1 == s2 ? 1 : 0;
+ if (s1 == s2)
+ return 1;
+
if (s1->attr.flavor != FL_PROCEDURE && s2->attr.flavor != FL_PROCEDURE)
return compare_type_rank (s1, s2);
if (s1->attr.flavor != FL_PROCEDURE || s2->attr.flavor != FL_PROCEDURE)
return 0;
- /* At this point, both symbols are procedures. */
- if ((s1->attr.function == 0 && s1->attr.subroutine == 0)
- || (s2->attr.function == 0 && s2->attr.subroutine == 0))
- return 0;
+ /* At this point, both symbols are procedures. It can happen that
+ external procedures are compared, where one is identified by usage
+ to be a function or subroutine but the other is not. Check TKR
+ nonetheless for these cases. */
+ if (s1->attr.function == 0 && s1->attr.subroutine == 0)
+ return s1->attr.external == 1 ? compare_type_rank (s1, s2) : 0;
+
+ if (s2->attr.function == 0 && s2->attr.subroutine == 0)
+ return s2->attr.external == 1 ? compare_type_rank (s1, s2) : 0;
+ /* Now the type of procedure has been identified. */
if (s1->attr.function != s2->attr.function
|| s1->attr.subroutine != s2->attr.subroutine)
return 0;