aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2018-09-11 19:44:04 +0200
committerJanus Weil <janus@gcc.gnu.org>2018-09-11 19:44:04 +0200
commit0e4cb16f565fa292328c7e57689b7ca0f09e0625 (patch)
treefbe9168c5ec760fc1fb05d45979400ef2ddc935b /gcc
parent2e3d2422343315fbe2c84c551eb7c8ef18021573 (diff)
downloadgcc-0e4cb16f565fa292328c7e57689b7ca0f09e0625.zip
gcc-0e4cb16f565fa292328c7e57689b7ca0f09e0625.tar.gz
gcc-0e4cb16f565fa292328c7e57689b7ca0f09e0625.tar.bz2
re PR fortran/87172 (Spurious "Derived type 'c_funptr' at (1) has not been declared" error after r263782)
fix PR 87172 2018-09-11 Janus Weil <janus@gcc.gnu.org> PR fortran/87172 * resolve.c (resolve_fl_derived): If a type has the 'use_assoc' attribute, then it was declared in another module, so there should be no error that it has not been declared. 2018-09-11 Janus Weil <janus@gcc.gnu.org> PR fortran/87172 * gfortran.dg/iso_c_binding_only_2.f90: New test case. From-SVN: r264214
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/resolve.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/iso_c_binding_only_2.f9014
4 files changed, 27 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c02276f..7ce93ab 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2018-09-11 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/87172
+ * resolve.c (resolve_fl_derived): If a type has the 'use_assoc'
+ attribute, then it was declared in another module, so there should be
+ no error that it has not been declared.
+
2018-09-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/87277
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index ded2762..ea0ce80 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -14245,7 +14245,7 @@ resolve_fl_derived (gfc_symbol *sym)
&sym->declared_at))
return false;
- if (sym->components == NULL && !sym->attr.zero_comp)
+ if (sym->components == NULL && !sym->attr.zero_comp && !sym->attr.use_assoc)
{
gfc_error ("Derived type %qs at %L has not been declared",
sym->name, &sym->declared_at);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3e35910..a429bc3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-11 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/87172
+ * gfortran.dg/iso_c_binding_only_2.f90: New test case.
+
2018-09-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/87277
diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_only_2.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_only_2.f90
new file mode 100644
index 0000000..03fafe3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/iso_c_binding_only_2.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR 87172: [9 Regression] Spurious "Derived type 'c_funptr' at (1) has not been declared" error after r263782
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+
+module m1
+ use iso_c_binding, only: c_funptr
+end module
+
+module m2
+ use m1
+ use iso_c_binding
+end module